Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { /** * @param length * @return A direct, native-order buffer */ public static ByteBuffer createByteBuffer(int length) { return ByteBuffer.allocateDirect(length).order(ByteOrder.nativeOrder()); } }