Here you can find the source of floatToBuffer(float[] a)
public static FloatBuffer floatToBuffer(float[] a)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer mBuffer; public static FloatBuffer floatToBuffer(float[] a) { ByteBuffer mbb = ByteBuffer.allocateDirect(a.length * 4); mbb.order(ByteOrder.nativeOrder()); mBuffer = mbb.asFloatBuffer();//from w w w. jav a 2s.c om mBuffer.put(a); mBuffer.position(0); return mBuffer; } }