Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { private static final int BYTES_PER_FLOAT = 4; public static FloatBuffer makeFloatBuffer4(float $a, float $b, float $c, float $d) { ByteBuffer b = ByteBuffer.allocateDirect(4 * BYTES_PER_FLOAT); b.order(ByteOrder.nativeOrder()); FloatBuffer buffer = b.asFloatBuffer(); buffer.put($a); buffer.put($b); buffer.put($c); buffer.put($d); buffer.position(0); return buffer; } }