Here you can find the source of createFloatBuffer(float[] floatData)
public static final FloatBuffer createFloatBuffer(float[] floatData)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static final int BYTES_PER_FLOAT = 4; public static final FloatBuffer createFloatBuffer(float[] floatData) { FloatBuffer buffer = ByteBuffer .allocateDirect(floatData.length * BYTES_PER_FLOAT) .order(ByteOrder.nativeOrder()).asFloatBuffer() .put(floatData);//from www .j a v a 2 s .c o m buffer.position(0); return buffer; } public static final FloatBuffer createFloatBuffer(int nElements, int stride) { FloatBuffer buffer = ByteBuffer .allocateDirect(nElements * stride * BYTES_PER_FLOAT) .order(ByteOrder.nativeOrder()).asFloatBuffer(); buffer.position(0); return buffer; } }