Java ByteBuffer to Long readUInt64(ByteBuffer bb)

Here you can find the source of readUInt64(ByteBuffer bb)

Description

read U Int

License

LGPL

Declaration

public static BigInteger readUInt64(ByteBuffer bb) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.math.BigInteger;
import java.nio.ByteBuffer;

public class Main {
    public static BigInteger readUInt64(ByteBuffer bb) {
        byte[] data = new byte[8];
        bb.get(data);/*from w w  w . ja v  a  2  s.co m*/
        long l1 = (((long) data[0] & 0xff) << 0)
                | (((long) data[1] & 0xff) << 8)
                | (((long) data[2] & 0xff) << 16)
                | (((long) data[3] & 0xff) << 24);
        long l2 = (((long) data[4] & 0xff) << 0)
                | (((long) data[5] & 0xff) << 8)
                | (((long) data[6] & 0xff) << 16)
                | (((long) data[7] & 0xff) << 24);
        return BigInteger.valueOf((l1 << 0) | (l2 << 32));
    }
}

Related

  1. readUB4(ByteBuffer buffer)
  2. readUBEInt16(ByteBuffer b)
  3. readUInt16(ByteBuffer bb)
  4. readUInt16BE(ByteBuffer bb)
  5. readUInt32(ByteBuffer buf, int length)
  6. readUInt64(ByteBuffer byteBuffer)
  7. readUInt8(ByteBuffer bb)
  8. readVarLong(ByteBuffer buff)
  9. readVarlong(ByteBuffer buffer)