Java tutorial
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer toFloatBuffer(float[] v) { ByteBuffer buff = ByteBuffer.allocateDirect(v.length * 4); buff.order(ByteOrder.nativeOrder()); FloatBuffer buffer = buff.asFloatBuffer(); buffer.put(v); buffer.position(0); return buffer; } }