List of utility methods to do Byte Array to Little Endian Convert
int | getByteLittleEndian_unit16(byte[] theBytes, int idx) pull out unsigned 16 bits integer out of the array. int sum = 0; for (int i = 0; i < 2; i++) { sum = (sum << 8) + (0xff & theBytes[i + idx]); return flip16(sum); |
int | getWord(byte[] buffer, int pos) Convert byte to 16 bit integer. int first = getUnsignedSafe(buffer, pos); int second = getUnsignedSafe(buffer, pos + 1); int res = second + ((first << 8) & 0x0000FF00); return res; |