Here you can find the source of ConvToFloatBuffer(float buf[])
public static FloatBuffer ConvToFloatBuffer(float buf[])
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer ConvToFloatBuffer(float buf[]) { FloatBuffer ReturnBuffer; ByteBuffer vbb = ByteBuffer.allocateDirect(buf.length * 4); vbb.order(ByteOrder.nativeOrder()); ReturnBuffer = vbb.asFloatBuffer(); ReturnBuffer.put(buf);/*from w w w. java 2s . co m*/ ReturnBuffer.position(0); return ReturnBuffer; } }