Java Utililty Methods Long Number Create

List of utility methods to do Long Number Create

Description

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

Method

longtoLong(byte[] bytes, int offset)
Convert a byte array to a long value
int value = 0;
if (bytes != null && bytes.length >= 8) {
    for (int i = 0; i < 8; ++i) {
        value += (0x000000FF & bytes[offset + i]) << ((7 - i) * 8);
return value;
longtoLong(byte[] data)
Convert byte array to long
if (data == null || data.length != 8)
    return 0x0;
return (long) ((long) (0xff & data[0]) << 56 | (long) (0xff & data[1]) << 48 | (long) (0xff & data[2]) << 40
        | (long) (0xff & data[3]) << 32 | (long) (0xff & data[4]) << 24 | (long) (0xff & data[5]) << 16
        | (long) (0xff & data[6]) << 8 | (long) (0xff & data[7]) << 0);
longtoLong(byte[] data)
to Long
return (((long) data[0] << 56) + ((long) (data[1] & 255) << 48) + ((long) (data[2] & 255) << 40)
        + ((long) (data[3] & 255) << 32) + ((long) (data[4] & 255) << 24) + ((data[5] & 255) << 16)
        + ((data[6] & 255) << 8) + ((data[7] & 255) << 0));
longtoLong(byte[] data)
Translates a network order byte representation of a long back into a java primitive.
return toLong(data, 0);
longtoLong(byte[] data)
to Long
if (data.length != 8)
    return 0;
return (long) data[0] << 56 | (long) data[1] << 48 | (long) data[2] << 40 | (long) data[3] << 32
        | (int) data[4] << 24 | (int) data[5] << 16 | (int) data[6] << 8 | (int) data[7];
longtoLong(byte[] in)
to Long
return (((toInt(in[0], in[1], in[2], in[3]))) | ((long) (toInt(in[4], in[5], in[6], in[7])) << (long) 32));
longtoLong(byte[] input)
Converts a given byte array to a long .
assert input.length == 8 : "toLong(): Byte array length must be 8.";
long output = 0;
output = ((long) (input[0] & 0xff) << 56);
output |= ((long) (input[1] & 0xff) << 48);
output |= ((long) (input[2] & 0xff) << 40);
output |= ((long) (input[3] & 0xff) << 32);
output |= ((long) (input[4] & 0xff) << 24);
output |= ((long) (input[5] & 0xff) << 16);
...
longtoLong(byte[] key)
to Long
assert isLong(key);
return (((long) key[0] << 56) + ((long) (key[1] & 255) << 48) + ((long) (key[2] & 255) << 40)
        + ((long) (key[3] & 255) << 32) + ((long) (key[4] & 255) << 24) + ((key[5] & 255) << 16)
        + ((key[6] & 255) << 8) + ((key[7] & 255) << 0));
longtoLong(byte[] memory, int index)
to Long
return ((long) memory[index] & 0xff) << 56 | ((long) memory[index + 1] & 0xff) << 48
        | ((long) memory[index + 2] & 0xff) << 40 | ((long) memory[index + 3] & 0xff) << 32
        | ((long) memory[index + 4] & 0xff) << 24 | ((long) memory[index + 5] & 0xff) << 16
        | ((long) memory[index + 6] & 0xff) << 8 | (long) memory[index + 7] & 0xff;
longtoLong(byte[] n)
Converter
long r = 0;
long m = 1;
for (int i = 0; i < 8; i++) {
    int b = n[i];
    if (b < 0) {
        b += 256;
    r += b * m;
...