How to get the Floatbuffer stored float[]?

6.7k Views Asked by At

Having -

FloatBuffer floatBuffer  = FloatBuffer.allocate(SIZE)

how could I get its float[SIZE] ?

3

There are 3 best solutions below

0
Srikanth Reddy Lingala On BEST ANSWER

FloatBuffer.array() should return you the float array

0
Konstantin Yovkov On

You can use the FloatBuffer#get(float[] dst) method to copy the underlying array to a new destination array.

0
Alexis C. On

To get the float[] array backed by the buffer just call the method array() :

float[] arrayBuff = floatBuffer.array();