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 floatToBuffer(float[] a) { ByteBuffer mbb = ByteBuffer.allocateDirect(a.length * 4); mbb.order(ByteOrder.nativeOrder()); FloatBuffer fBuffer = mbb.asFloatBuffer(); fBuffer.put(a);/*from ww w. j av a2 s. co m*/ fBuffer.position(0); return fBuffer; } }