Here you can find the source of makeByteBuffer(int size)
public static ByteBuffer makeByteBuffer(int size)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { public static ByteBuffer makeByteBuffer(byte[] arr) { ByteBuffer bb = ByteBuffer.allocateDirect(arr.length); bb.order(ByteOrder.nativeOrder()); bb.put(arr);//www . ja v a 2 s. c om bb.position(0); return bb; } public static ByteBuffer makeByteBuffer(int size) { ByteBuffer bb = ByteBuffer.allocateDirect(size); bb.position(0); return bb; } }