List of utility methods to do Array Unpack
void | unpackLE(long aValue, byte[] aBuf, int aOffset) unpack LE aBuf[aOffset + 0] = (byte) aValue; aValue >>= 8; aBuf[aOffset + 1] = (byte) aValue; aValue >>= 8; aBuf[aOffset + 2] = (byte) aValue; aValue >>= 8; aBuf[aOffset + 3] = (byte) aValue; aValue >>= 8; ... |
byte[] | UnpackLittle32(byte[] bytes, int integer) Unpacks a 32-bit integer value into four bytes in BIG endian format. bytes[3] = (byte) ((integer & 0x000000ff)); bytes[2] = (byte) ((integer & 0x0000ff00) >> 8); bytes[1] = (byte) ((integer & 0x00ff0000) >> 16); bytes[0] = (byte) ((integer & 0xff000000) >> 24); return bytes; |
long | unpackLittleEndianLong(byte[] bytes) Convert the given little-endian packed byte[8] into a long. if (bytes == null) { return 0; assert bytes.length == 8 : bytes.length; long unpacked = 0; for (int i = 0; i < 8; ++i) { long cur = (bytes[i] & 0xFFL) << (i * 8); unpacked += cur; ... |
long | unpackLong(byte[] arr, int i, int j) unpack Long if (arr.length < i + j) { return 0L; long l = 0L; int k = (j - 1) * 8; for (int i1 = 0; i1 < j; i1++) { l += byteToInt(arr[i + i1]) << k; k -= 8; ... |
int | unpackw(int[] sourcearray, int arraypos, int[] data, int num, int b) unpackw int howmanyfit = 32 / b; if (num > howmanyfit) { System.arraycopy(sourcearray, arraypos, data, 0, num); return num + arraypos; final int mask = (1 << b) - 1; int val = sourcearray[arraypos]; for (int k = 0; k < num; ++k) { ... |