-package com.nexuiz.demorecorder.application.democutter;\r
-import java.nio.ByteBuffer;\r
-import java.nio.ByteOrder;\r
-\r
-\r
-public class DemoCutterUtils {\r
-\r
- public static float byteArrayToFloat(byte[] array) {\r
- byte[] tmp = new byte[4];\r
- System.arraycopy(array, 0, tmp, 0, 4);\r
- int accum = 0;\r
- int i = 0;\r
- for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {\r
- accum |= ((long) (tmp[i++] & 0xff)) << shiftBy;\r
- }\r
- return Float.intBitsToFloat(accum);\r
- }\r
-\r
- public static byte[] convertLittleEndian(int i) {\r
- ByteBuffer bb = ByteBuffer.allocate(4);\r
- bb.order(ByteOrder.LITTLE_ENDIAN);\r
- bb.putInt(i);\r
- return bb.array();\r
- }\r
-\r
- public static byte[] mergeByteArrays(byte[] array1, byte[] array2) {\r
- ByteBuffer bb = ByteBuffer.allocate(array1.length + array2.length);\r
- bb.put(array1);\r
- bb.put(array2);\r
- return bb.array();\r
- }\r
-\r
- public static int convertLittleEndian(byte[] b) {\r
- ByteBuffer bb = ByteBuffer.allocate(4);\r
- bb.order(ByteOrder.LITTLE_ENDIAN);\r
- bb.put(b);\r
- bb.position(0);\r
- return bb.getInt();\r
- }\r
-}\r
+package com.nexuiz.demorecorder.application.democutter;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+
+public class DemoCutterUtils {
+
+ public static float byteArrayToFloat(byte[] array) {
+ byte[] tmp = new byte[4];
+ System.arraycopy(array, 0, tmp, 0, 4);
+ int accum = 0;
+ int i = 0;
+ for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
+ accum |= ((long) (tmp[i++] & 0xff)) << shiftBy;
+ }
+ return Float.intBitsToFloat(accum);
+ }
+
+ public static byte[] convertLittleEndian(int i) {
+ ByteBuffer bb = ByteBuffer.allocate(4);
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ bb.putInt(i);
+ return bb.array();
+ }
+
+ public static byte[] mergeByteArrays(byte[] array1, byte[] array2) {
+ ByteBuffer bb = ByteBuffer.allocate(array1.length + array2.length);
+ bb.put(array1);
+ bb.put(array2);
+ return bb.array();
+ }
+
+ public static int convertLittleEndian(byte[] b) {
+ ByteBuffer bb = ByteBuffer.allocate(4);
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ bb.put(b);
+ bb.position(0);
+ return bb.getInt();
+ }
+}