Java Utililty Methods Long Number From

List of utility methods to do Long Number From

Description

The list of methods to do Long Number From are organized into topic(s).

Method

longlongFromBase64(String value)
Decode a base64 string into a long value.
int pos = 0;
long longVal = base64Values[value.charAt(pos++)];
int len = value.length();
while (pos < len) {
    longVal <<= 6;
    longVal |= base64Values[value.charAt(pos++)];
return longVal;
...
longlongFromBigEndainArray(byte[] buf, int offset, int len)
utility to build a long from values in an array of bytes in bigEndian order
long val = 0;
for (int i = 0; i < len; i++) {
    val = val << 8;
    int d = (0xff & buf[i + offset]);
    val += d;
return val;
longlongFromByteArray(byte[] bytes)
long From Byte Array
long value = 0;
for (int i = 0; i < bytes.length; i++) {
    value = (value << 8) + (bytes[i] & 0xFF);
return value;
longlongFromByteArray(final byte[] buf, final int offset)
long From Byte Array
long v = 0;
v |= ((((long) buf[offset + 0]) & 0xFF) << 56);
v |= ((((long) buf[offset + 1]) & 0xFF) << 48);
v |= ((((long) buf[offset + 2]) & 0xFF) << 40);
v |= ((((long) buf[offset + 3]) & 0xFF) << 32);
v |= ((((long) buf[offset + 4]) & 0xFF) << 24);
v |= ((((long) buf[offset + 5]) & 0xFF) << 16);
v |= ((((long) buf[offset + 6]) & 0xFF) << 8);
...
longlongFromBytes(byte b8, byte b7, byte b6, byte b5, byte b4, byte b3, byte b2, byte b1)
long From Bytes
long l = 0;
l += (((long) b1) & 0xFF);
l += (((long) b2) & 0xFF) << 8;
l += (((long) b3) & 0xFF) << 16;
l += (((long) b4) & 0xFF) << 24;
l += (((long) b5) & 0xFF) << 32;
l += (((long) b6) & 0xFF) << 40;
l += (((long) b7) & 0xFF) << 48;
...
longlongFrombytes(byte[] b, int pos)
long Frombytes
long c = b2i(b[pos + 4]) + b2i(b[pos + 5]) * 256 + b2i(b[pos + 6]) * 65536 + b2i(b[pos + 7]) * 65536 * 256;
c = c << 16;
return c;
longlongFromBytes(byte[] buffer, int offset)
Converts consecutive bytes from a buffer into a long.
return integralFromBytes(buffer, offset, 8);
longlongFromBytes(byte[] bytes, int index)
Unsigned Long from 8 bytes
if ((bytes == null) || (bytes.length < 7)) {
    return -1;
int idx = index;
long val = 0;
for (int i = 0; i < 8; i++) {
    if (i < 7) {
        val |= (((long) bytes[idx + i] & 0x000000ff) << (64 - ((i + 1) * 8)));
...
longlongFromBytes(byte[] bytes, int offset)
long From Bytes
long ret = 0;
ret |= (bytes[offset + 0] & 0xFFL) << 56;
ret |= (bytes[offset + 1] & 0xFFL) << 48;
ret |= (bytes[offset + 2] & 0xFFL) << 40;
ret |= (bytes[offset + 3] & 0xFFL) << 32;
ret |= (bytes[offset + 4] & 0xFFL) << 24;
ret |= (bytes[offset + 5] & 0xFFL) << 16;
ret |= (bytes[offset + 6] & 0xFFL) << 8;
...
longlongFromDB(String dbLong)
long From DB
String s = dbLong.substring(2);
return Long.parseLong(s);