Here you can find the source of arr2FloatBuffer(float[] coords)
public static FloatBuffer arr2FloatBuffer(float[] coords)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer arr2FloatBuffer(float[] coords) { ByteBuffer ibb = ByteBuffer.allocateDirect(coords.length * 4); ibb.order(ByteOrder.nativeOrder()); FloatBuffer fbb = ibb.asFloatBuffer(); fbb.put(coords);//from w w w . j av a2s . c o m fbb.position(0); return fbb; } }