Java IO Tutorial - Java FloatBuffer.array()








Syntax

FloatBuffer.array() has the following syntax.

public final float[] array()

Example

In the following code shows how to use FloatBuffer.array() method.

//  ww  w  .j a  v  a2  s . c om
import java.nio.FloatBuffer;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    floatBuffer.put(1.23F);
    
    System.out.println(Arrays.toString(floatBuffer.array()));

  }
}

The code above generates the following result.