Here you can find the source of bytes(ByteBuffer buf)
public static byte[] bytes(ByteBuffer buf)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static byte[] bytes(ByteBuffer buf) { byte[] d = new byte[buf.limit()]; buf.get(d);/* ww w.j av a 2s . c o m*/ return d; } }