Java Utililty Methods ByteBuffer to Long

List of utility methods to do ByteBuffer to Long

Description

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

Method

longgetUInt(ByteBuffer buffer)
get U Int
assert (buffer.capacity() - buffer.position() >= 4);
byte[] data = new byte[4];
data[3] = buffer.get();
data[2] = buffer.get();
data[1] = buffer.get();
data[0] = buffer.get();
return ((data[0] << 24) & 0xff000000l) | ((data[1] << 16) & 0x00ff0000l) | ((data[2] << 8) & 0x0000ff00l)
        | (data[3] & 0x000000ffl);
...
longgetUInt(ByteBuffer buffer)
get U Int
return getUInt(buffer, buffer.capacity(), DEFAULT_BYTE_ORDER);
longgetUInt(java.nio.ByteBuffer buffer)
get U Int
return 0xFFFFFFFFL & (long) buffer.getInt();
int[]getUInt16(ByteBuffer b, int n)
get U Int
int i[] = new int[n];
for (int k = 0; k < i.length; k++) {
    i[k] = getUInt16(b);
return i;
intgetUInt16(ByteBuffer buffer)
get U Int
int first = 0xff & buffer.get();
int second = 0xff & buffer.get();
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) {
    return (first << 8 | second);
} else {
    return (first | second << 8);
intgetUInt16(ByteBuffer buffer)
get U Int
int first = 0xff & buffer.get();
int second = 0xff & buffer.get();
if (buffer.order() == ByteOrder.LITTLE_ENDIAN) {
    return (first << 8 | second);
} else {
    return (first | second << 8);
longgetUInt32(ByteBuffer b)
get U Int
return (b.getInt() & 0xFFFFFFFFL);
short[]getUInt8(ByteBuffer b, int n)
get U Int
short s[] = new short[n];
for (int k = 0; k < s.length; k++) {
    s[k] = getUInt8(b);
return s;
longgetUInteger(ByteBuffer bb)
get U Integer
return bb.getInt() & 0xffffffffL;
longreadLong(ByteBuffer buf, int length)
read Long
if ((buf.position() + length) <= buf.limit() && length <= 8) {
    long r = 0;
    for (int i = 0; i < length; i++) {
        r |= (((long) buf.get() & 0xff) << (i << 3));
    return r;
return 0;
...