Here you can find the source of writeLong(ByteBuffer buf, long value, int len)
public static void writeLong(ByteBuffer buf, long value, int len)
//package com.java2s; /**/*w w w. jav a 2 s . c o m*/ * Project: ${puma-common.aid} * <p/> * File Created at 2012-6-6 $Id$ * <p/> * Copyright 2010 dianping.com. All rights reserved. * <p/> * This software is the confidential and proprietary information of Dianping * Company. ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the terms * of the license agreement you entered into with dianping.com. */ import java.nio.ByteBuffer; public class Main { public static void writeLong(ByteBuffer buf, long value, int len) { for (int i = 0; i < len; i++) { buf.put((byte) ((value >>> (i << 3)) & 0xff)); } } }