Java FloatBuffer create from float array
import java.nio.FloatBuffer; import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { float[] floatArray = new float[] { 3.4f, 3.5f, 3.6f, 3.7f, 3.8f, 3.1234f, 6.2344f, 8.34f, 9.8f }; FloatBuffer bb = FloatBuffer.wrap(floatArray); floatArray = toArray(bb);// w w w . java 2s . c o m System.out.println(Arrays.toString(floatArray)); } public static float[] toArray(final FloatBuffer buffer) { float[] array = new float[buffer.limit()]; buffer.get(array); return array; } }