Android examples for java.nio:FloatBuffer
float Array To FloatBuffer
//package com.book2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer floatArrayToBuffer(float[] floatArray) { ByteBuffer byteBuffer = ByteBuffer .allocateDirect(floatArray.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); floatBuffer.put(floatArray);/*ww w . jav a 2s . c o m*/ floatBuffer.position(0); return floatBuffer; } }