Here you can find the source of convertLittleEndianLong(ByteBuffer buff, int size)
public static long convertLittleEndianLong(ByteBuffer buff, int size)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { private static final int LONG_SIZE = 8; public static long convertLittleEndianLong(ByteBuffer buff, int size) { if (size <= 0 || size > LONG_SIZE) { throw new IllegalArgumentException("size MUST be less 8."); }/*from ww w .j av a 2s. c o m*/ byte[] array = new byte[size]; buff.get(array); ByteBuffer bbf = ByteBuffer.allocate(LONG_SIZE); bbf.put(array); bbf.order(ByteOrder.LITTLE_ENDIAN); if (size < LONG_SIZE) { bbf.position(LONG_SIZE); } bbf.flip(); return bbf.getLong(); } }