Here you can find the source of readLong64ls(int size, ByteBuffer byteBuf)
static long readLong64ls(int size, ByteBuffer byteBuf) throws Exception
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { static long readLong64ls(int size, ByteBuffer byteBuf) throws Exception { switch (size) { case 0://w w w. ja v a 2 s . c om return 0; case 1: return byteBuf.get(); case 2: return byteBuf.getShort(); case 3: return (byteBuf.get() << 16) + readUnsignedShort(byteBuf); case 4: return byteBuf.getInt(); case 5: return (((long) (byteBuf.get())) << 32) + readUnsignedInt(byteBuf); case 6: return (((long) (byteBuf.getShort())) << 32) + readUnsignedInt(byteBuf); case 7: return (((long) (byteBuf.get())) << 48) + (((long) (readUnsignedShort(byteBuf))) << 32) + readUnsignedInt(byteBuf); case 8: return byteBuf.getLong(); default: assert (false); return 0; } } static int readUnsignedShort(ByteBuffer byteBuf) throws Exception { int val = byteBuf.getShort(); if (val < 0) val &= 0xFFFF; return val; } static long readUnsignedInt(ByteBuffer byteBuf) throws Exception { long val = byteBuf.getInt(); if (val < 0) val &= 0xFFFFFFFFL; return val; } }