Here you can find the source of buildFloatBuffer(float[] buffer)
Parameter | Description |
---|---|
buffer | a parameter |
public static FloatBuffer buildFloatBuffer(float[] buffer)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { /**//ww w. ja va 2 s .c o m * build FloatBuffer: float[] -> FloatBuffer * * @param buffer * @return FloatBuffer */ public static FloatBuffer buildFloatBuffer(float[] buffer) { FloatBuffer ret = null; if (buffer != null) { ByteBuffer byteBuffer = ByteBuffer .allocateDirect(buffer.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); ret = byteBuffer.asFloatBuffer(); ret.put(buffer); ret.position(0); } return ret; } }