List of utility methods to do Byte Array to Int
long | Bytes2Int64(byte[] sour, int offset) Bytes Int return ((((long) sour[offset] << 56) & 0xFF00000000000000L) | (((long) sour[offset + 1] << 48) & 0x00FF000000000000L) | (((long) sour[offset + 2] << 40) & 0x0000FF0000000000L) | (((long) sour[offset + 3] << 32) & 0x000000FF00000000L) | ((sour[offset + 4] << 24) & 0x00000000FF000000L) | ((sour[offset + 5] << 16) & 0x0000000000FF0000L) | ((sour[offset + 6] << 8) & 0x000000000000FF00L) | (sour[offset + 7] & 0x00000000000000FFL)); |
int[] | bytes2IntArray(byte[] bytes) bytes Int Array if (bytes == null || bytes.length < 4) { return new int[0]; int[] array = new int[bytes.length / 4]; int byteIndex = 0; int arrayIndex = 0; while (byteIndex < bytes.length) { int v = bytes[byteIndex++] & 0xff; ... |
int | bytes2Integer(byte[] byteVal) bytes Integer int result = 0; for (int i = 0; i < byteVal.length; i++) { int tmpVal = (byteVal[i] << (8 * (3 - i))); switch (i) { case 0: tmpVal = tmpVal & 0xFF000000; break; case 1: ... |
int | bytes2LengthToIntLowOrder(byte[] intBytes) bytes Length To Int Low Order byte[] data = new byte[2]; System.arraycopy(intBytes, 0, data, 0, 2); return (int) ((0 & 0xff) << 24) | ((0 & 0xff) << 16) | ((data[1] & 0xff) << 8) | ((data[0] & 0xff) << 0); |
int | bytes2ToInt(byte[] inputValues) bytes To Int return ((inputValues[0] & BYTE_MASK) << 8) | (inputValues[1] & BYTE_MASK);
|
long | Bytes2Uint32(byte[] sour, int offset) Bytes Uint return Bytes2Int32(sour, offset) & 0xFFFFFFFFL;
|
int | bytesToInt(byte a) Convert a single byte to a 32-bit int, with sign extension. return (int) a; |
int | bytesToInt(byte A, byte B, byte C, byte D) bytes To Int int i = (D & MASK_TO_BYTE); i |= ((C & MASK_TO_BYTE) << 8); i |= ((B & MASK_TO_BYTE) << 16); i |= ((A & MASK_TO_BYTE) << 24); return i; |
int | bytesToInt(byte abyte0[], int i, int j) bytes To Int int k = 0; for (int l = 0; l < j; l++) k = k << 8 | abyte0[l + i] & 0xff; return k; |
int | bytesToInt(byte b1, byte b2, byte b3, byte b4) bytes To Int return (b1 << 24 & 0xFFFFFFFF) | (b2 << 16 & 0xFFFFFF) | (b3 << 8 & 0xFFFF) | (b4 & 0xFF) & 0xFFFFFFFF;
|