List of utility methods to do Long Number Create
int[] | convertLongtoMultiByte(long val) convert Longto Multi Byte int size; if ((val >> 56) > 0) { size = 8; } else if ((val >> 48) > 0) { size = 7; } else if ((val >> 40) > 0) { size = 6; } else if ((val >> 32) > 0) { ... |
int | fromLong(byte[] buffer, int pos, long l) from Long buffer[pos] = (byte) ((l >> 56) & 255); buffer[pos + 1] = (byte) ((l >> 48) & 255); buffer[pos + 2] = (byte) ((l >> 40) & 255); buffer[pos + 3] = (byte) ((l >> 32) & 255); buffer[pos + 4] = (byte) ((l >> 24) & 255); buffer[pos + 5] = (byte) ((l >> 16) & 255); buffer[pos + 6] = (byte) ((l >> 8) & 255); buffer[pos + 7] = (byte) (l & 255); ... |
void | fromLong(long value, byte[] arr, int offset) from Long value ^= 1L << 63; arr[offset] = (byte) (value >>> 56); arr[offset + 1] = (byte) (value >>> 48); arr[offset + 2] = (byte) (value >>> 40); arr[offset + 3] = (byte) (value >>> 32); arr[offset + 4] = (byte) (value >>> 24); arr[offset + 5] = (byte) (value >>> 16); arr[offset + 6] = (byte) (value >>> 8); ... |
long | fromLongLE(byte src[], int offset, int numBytes) Little endian, i.e. if (numBytes <= 0 || numBytes > 8) throw new IllegalArgumentException("Invalid number of bytes"); long rv = 0; for (int i = offset + numBytes - 1; i >= offset; i--) { rv <<= 8; rv |= src[i] & 0xFF; if (rv < 0) ... |
long | toLong(boolean b) Return the long value of the boolean. If boolean is TRUE this will return 1, else 0. if (b) { return 1L; return 0L; |
long | toLong(boolean... a) Packs boolean array to integer, the booleans with greater indices go first if (a.length >= 64) { throw new IllegalArgumentException( "while packing boolean array in int, the array length should be less than 32"); int n = 0; for (int i = (a.length - 1); i >= 0; --i) { n = (n << 1) | (a[i] ? 1 : 0); return n; |
long | toLong(byte b) to Long return 0xff & b;
|
long | toLong(byte byte7, byte byte6, byte byte5, byte byte4, byte byte3, byte byte2, byte byte1, byte byte0) Convert 8 bytes into a long. return toLong(toInt(byte7, byte6, byte5, byte4), toInt(byte3, byte2, byte1, byte0)); |
long | toLong(byte... b) to Long long l = 0; int len = b.length; for (int i = 0; i < len && i < 8; i++) { l = (long) l << 8 | byte2UnsignInt(b[i]); return l; |
long | toLong(byte... b) to Long int mask = 0xff; int temp = 0; long res = 0; int byteslen = b.length; if (byteslen > 8) { return Long.valueOf(0L); for (int i = 0; i < byteslen; i++) { ... |