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