Here you can find the source of getLongByteBuffer(long id)
public static final ByteBuffer getLongByteBuffer(long id)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static final int longSize = 8; public static final ByteBuffer getLongByteBuffer(long id) { ByteBuffer buffer = ByteBuffer.allocate(longSize); buffer.putLong(id);//ww w .j a v a2 s . com buffer.flip(); return buffer; } public static final ByteBuffer getLongByteBuffer(long[] ids) { ByteBuffer buffer = ByteBuffer.allocate(longSize * ids.length); for (int i = 0; i < ids.length; i++) buffer.putLong(ids[i]); buffer.flip(); return buffer; } }