Here you can find the source of createFloatBuffer(int numFloats)
Parameter | Description |
---|---|
numFloats | The number of floats this FloatBuffer should hold. |
public static FloatBuffer createFloatBuffer(int numFloats)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { /**// w ww .j a va 2 s .co m * Return a FloatBuffer which can hold the specified number of floats. * * @param numFloats The number of floats this FloatBuffer should hold. * @return A float buffer which can hold the specified number of floats. */ public static FloatBuffer createFloatBuffer(int numFloats) { return ByteBuffer.allocateDirect(numFloats * Float.BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer(); } }