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