Here you can find the source of setLong(ByteBuffer buffer, long data)
public static void setLong(ByteBuffer buffer, long data)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void setLong(ByteBuffer buffer, long data) { assert (buffer.capacity() - buffer.position() >= 8); buffer.put((byte) (data & 0x00000000000000ffl)); buffer.put((byte) ((data & 0x000000000000ff00l) >>> 8)); buffer.put((byte) ((data & 0x0000000000ff0000l) >>> 16)); buffer.put((byte) ((data & 0x00000000ff000000l) >>> 24)); buffer.put((byte) ((data & 0x000000ff00000000l) >>> 32)); buffer.put((byte) ((data & 0x0000ff0000000000l) >>> 40)); buffer.put((byte) ((data & 0x00ff000000000000l) >>> 48)); buffer.put((byte) ((data & 0xff00000000000000l) >>> 56)); }//from ww w . ja va 2 s .c o m }