List of utility methods to do Long Number Create
long | toLong(byte[] buf) to Long long result = 0; for (int i = 0; i < buf.length; i++) { long k = buf[i] & 0xff; long t = k << (i * 8); result |= t; return result; |
long | toLong(byte[] buf) to Long int n = 0; for (byte b : buf) { n = (n << 8) + (b & 0xff); return n; |
long | toLong(byte[] buf, int off) Converts 8 bytes to a long at the specified offset in the given byte array.
return ((long) (toInt(buf, off)) << 32) + (toInt(buf, off + 4) & 0xFFFFFFFFL); |
long | toLong(byte[] buf, int pos) to Long return ((long) toUnsignedByte(buf, pos + 0)) << 56 + ((long) toUnsignedByte(buf, pos + 1)) << 48 + ((long) toUnsignedByte(buf, pos + 2)) << 40 + ((long) toUnsignedByte(buf, pos + 3)) << 32 + ((long) toUnsignedByte(buf, pos + 4)) << 24 + ((long) toUnsignedByte(buf, pos + 5)) << 16 + ((long) toUnsignedByte(buf, pos + 6)) << 8 + ((long) toUnsignedByte(buf, pos + 7)); |
long | toLong(byte[] byteArray) to Long if (byteArray == null || byteArray.length != 8) return 0x0; return (long) ((long) (0xff & byteArray[0]) << 56 | (long) (0xff & byteArray[1]) << 48 | (long) (0xff & byteArray[2]) << 40 | (long) (0xff & byteArray[3]) << 32 | (long) (0xff & byteArray[4]) << 24 | (long) (0xff & byteArray[5]) << 16 | (long) (0xff & byteArray[6]) << 8 | (long) (0xff & byteArray[7]) << 0); |
long | toLong(byte[] bytes) to Long long num = 0; if (bytes != null) { for (int i = bytes.length - 1, j = 0; i >= 0; i--, j++) { num += (long) (bytes[i] & 0xff) << (j * 8); return num; |
long | toLong(byte[] bytes) to Long long result = 0; result += (bytes[3] & 0xFF); result += ((bytes[2] & 0xFF) << 8); result += ((bytes[1] & 0xFF) << 16); result += (bytes[0] << 24); return result & 0xFFFFFFFFl; |
long | toLong(byte[] bytes) to Long assert (bytes.length >= 8); return ((0xffL & bytes[0]) << 56 | (0xffL & bytes[1]) << 48 | (0xffL & bytes[2]) << 40 | (0xffL & bytes[3]) << 32 | (0xffL & bytes[4]) << 24 | (0xffL & bytes[5]) << 16 | (0xffL & bytes[6]) << 8 | (0xffL & bytes[7]) << 0); |
long | toLong(byte[] bytes) to Long return (bytes[0] & 0xffL) << 56 | (bytes[1] & 0xffL) << 48 | (bytes[2] & 0xffL) << 40
| (bytes[3] & 0xffL) << 32 | (bytes[4] & 0xffL) << 24 | (bytes[5] & 0xffL) << 16
| (bytes[6] & 0xffL) << 8 | (bytes[7] & 0xffL);
|
long | toLong(byte[] bytes) to Long return ((long) bytes[7] & 255L) + (((long) bytes[6] & 255L) << 8) + (((long) bytes[5] & 255L) << 16) + (((long) bytes[4] & 255L) << 24) + (((long) bytes[3] & 255L) << 32) + (((long) bytes[2] & 255L) << 40) + (((long) bytes[1] & 255L) << 48) + (((long) bytes[0] & 255L) << 56); |