List of utility methods to do Byte Array to Long
long[] | byte2long(final byte[] v) Convert byte array to long array. long result[] = new long[v.length]; for (int i = 0; i < result.length; i++) result[i] = v[i]; return result; |
long | bytes2long(byte[] b) to long. return bytes2long(b, 0); |
long | bytes2long(byte[] byteArray, int offset) Convert an array of 8 bytes in a 64 bit long value in little endian order return (((long) byteArray[offset] & 0xFF) | (((long) byteArray[offset + 1] & 0xFF) << 8) | (((long) byteArray[offset + 2] & 0xFF) << 16) | (((long) byteArray[offset + 3] & 0xFF) << 24) | (((long) byteArray[offset + 4] & 0xFF) << 32) | (((long) byteArray[offset + 5] & 0xFF) << 40) | (((long) byteArray[offset + 6] & 0xFF) << 48) | (((long) byteArray[offset + 7] & 0xFF) << 56)); |
long | bytes2long(byte[] bytes) byteslong long num = 0; for (int i = 0; i < 8; i++) { num <<= 8; num |= (bytes[i] & 0xff); return num; |
long | bytes2long(byte[] bytes) byteslong long num = 0L; num = (((long) ((bytes[0] & 0xFF)) << 56) | ((long) ((bytes[1] & 0xFF)) << 48) | ((long) ((bytes[2] & 0xFF)) << 40) | ((long) ((bytes[3] & 0xFF)) << 32) | ((long) ((bytes[4] & 0xFF)) << 24) | ((long) ((bytes[5] & 0xFF)) << 16) | ((long) ((bytes[6] & 0xFF)) << 8) | ((long) ((bytes[7] & 0xFF)))); return num; |
long | bytes2Long(byte[] bytes) bytes to long if (bytes == null) { return 0; if (bytes.length != 8) { throw new IllegalArgumentException("Expecting 8 byte values to construct a long"); long value = 0; for (int i = 0; i < 8; i++) { ... |
long | bytes2Long(byte[] bytes) convert bytes to long. long num = 0; for (int ix = 0; ix < bytes.length; ++ix) { num <<= 8; num |= (bytes[ix] & 0xff); return num; |
long | bytes2long(byte[] bytes) byteslong return bytes2long(bytes, 0); |
long | bytes2Long(byte[] bytes) bytes Long return bytes2Long(bytes, 0);
|
long | bytes2long(byte[] bytes, boolean bigEndian) byteslong return bytes2long(bytes, 0, bigEndian); |