1 package com.nexuiz.demorecorder.application.democutter;
2 import java.nio.ByteBuffer;
3 import java.nio.ByteOrder;
6 public class DemoCutterUtils {
8 public static float byteArrayToFloat(byte[] array) {
9 byte[] tmp = new byte[4];
10 System.arraycopy(array, 0, tmp, 0, 4);
13 for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
14 accum |= ((long) (tmp[i++] & 0xff)) << shiftBy;
16 return Float.intBitsToFloat(accum);
19 public static byte[] convertLittleEndian(int i) {
20 ByteBuffer bb = ByteBuffer.allocate(4);
21 bb.order(ByteOrder.LITTLE_ENDIAN);
26 public static byte[] mergeByteArrays(byte[] array1, byte[] array2) {
27 ByteBuffer bb = ByteBuffer.allocate(array1.length + array2.length);
33 public static int convertLittleEndian(byte[] b) {
34 ByteBuffer bb = ByteBuffer.allocate(4);
35 bb.order(ByteOrder.LITTLE_ENDIAN);