Android Utililty Methods Byte Array to Long Convert

List of utility methods to do Byte Array to Long Convert

Description

The list of methods to do Byte Array to Long Convert are organized into topic(s).

Method

longgetLong(byte[] src, boolean bigEndin)
get Long
byte[] temp = { 0, 0, 0, 0, 0, 0, 0, 0 };
for (int i = 0; i < src.length; i++) {
    if (i > 7)
        break;
    temp[i] = src[i];
if (!bigEndin) {
    return makeLong(temp[7], temp[6], temp[5], temp[4], temp[3],
...
longuint16ToLong(byte[] buf, int offset)
uint To Long
return ((buf[offset++] & 0xFFL) << 0)
        | ((buf[offset++] & 0xFFL) << 8);
longuint32ToLong(byte[] buf, int offset)
uint To Long
return ((buf[offset++] & 0xFFL) << 0)
        | ((buf[offset++] & 0xFFL) << 8)
        | ((buf[offset++] & 0xFFL) << 16)
        | ((buf[offset] & 0xFFL) << 24);
longuint64ToLong(byte[] buf, int offset)
uint To Long
return ((buf[offset++] & 0xFFL) << 0)
        | ((buf[offset++] & 0xFFL) << 8)
        | ((buf[offset++] & 0xFFL) << 16)
        | ((buf[offset++] & 0xFFL) << 24)
        | ((buf[offset++] & 0xFFL) << 32)
        | ((buf[offset++] & 0xFFL) << 40)
        | ((buf[offset++] & 0xFFL) << 48)
        | ((buf[offset++] & 0xFFL) << 56);
...
longbyteArray2long(final byte[] number, final boolean swapHalfWord)
Converts a byte array to a long.
if (number.length % 2 != 0) {
    throw new UnsupportedOperationException();
long ret = 0;
int pos = 0;
byte tmp_number[] = new byte[number.length];
System.arraycopy(number, 0, tmp_number, 0, number.length);
if (!swapHalfWord) {
...
long[]parseLong(byte[] array, int offset, int multiplier, long[] result)
parse Long
result[0] = 0;
boolean decimal = false;
int i, m = multiplier;
for (i = offset; i < array.length; i++) {
    final byte digit = array[i];
    if (digit == '.') {
        decimal = true;
    } else if ((digit < '0' || digit > '9') || (decimal && m == 0)) {
...
long[]parseLong(byte[] array, int offset, long[] result)
parse Long
return parseLong(array, offset, 0, result);
longreadLong(byte[] buff, int pos)
Read a long value from the byte array at the given position.
return ((long) (readInt(buff, pos)) << 32)
        + (readInt(buff, pos + 4) & 0xffffffffL);