Here you can find the source of getLong(ByteBuffer buffer)
public static long getLong(ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static long getLong(ByteBuffer buffer) { assert (buffer.capacity() - buffer.position() >= 8); long[] data = new long[8]; data[7] = buffer.get();// w w w .ja v a 2 s .c om data[6] = buffer.get(); data[5] = buffer.get(); data[4] = buffer.get(); data[3] = buffer.get(); data[2] = buffer.get(); data[1] = buffer.get(); data[0] = buffer.get(); return ((data[0] << 56) & 0xff00000000000000l) | ((data[1] << 48) & 0x00ff000000000000l) | ((data[2] << 40) & 0x0000ff0000000000l) | ((data[3] << 32) & 0x000000ff00000000l) | ((data[4] << 24) & 0x00000000ff000000l) | ((data[5] << 16) & 0x0000000000ff0000l) | ((data[6] << 8) & 0x000000000000ff00l) | (data[7] & 0x00000000000000ffl); } }