Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer createFloatBuffer(float[] triangleCoords) { FloatBuffer vertexbuffer; ByteBuffer bb = ByteBuffer.allocateDirect(triangleCoords.length * 4);// 9*4 bb.order(ByteOrder.nativeOrder()); vertexbuffer = bb.asFloatBuffer(); vertexbuffer.put(triangleCoords); vertexbuffer.position(0); return vertexbuffer; } }