Java IO Tutorial - Java FloatBuffer.get(float[] dst)








Syntax

FloatBuffer.get(float[] dst) has the following syntax.

public FloatBuffer get(float[] dst)

Example

In the following code shows how to use FloatBuffer.get(float[] dst) method.

import java.nio.FloatBuffer;
import java.util.Arrays;
/*  w w w  .j av  a 2s . co  m*/
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    
    floatBuffer.put(0,1.23F);
    
    floatBuffer.rewind();
    
    float[] floatArray = new float[10];
    
    floatBuffer.get(floatArray);
    
    System.out.println(Arrays.toString(floatArray));

  }
}

The code above generates the following result.