Android examples for java.nio:FloatBuffer
make FloatBuffer
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { static FloatBuffer makeFloatBuffer(float[] array) { if (array == null) throw new IllegalArgumentException(); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4 * array.length); byteBuffer.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); floatBuffer.put(array);//from w w w . j a v a2s. co m floatBuffer.position(0); return floatBuffer; } }