Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { /** * @param pCapacity the capacity of the returned {@link FloatBuffer} in floats. * @return */ public static FloatBuffer allocateDirectFloatBuffer(final int pCapacity) { return ByteBuffer.allocateDirect(pCapacity * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); } }