Here you can find the source of getBytes(ByteBuffer byteBuffer, int length)
public static byte[] getBytes(ByteBuffer byteBuffer, int length)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static byte[] getBytes(ByteBuffer byteBuffer, int length) { byte[] bytes = new byte[length]; byteBuffer.get(bytes);/*from www . jav a 2 s.co m*/ return bytes; } }