Java IO Tutorial - Java FloatBuffer.get(float[] dst, int offset, int length)








Syntax

FloatBuffer.get(float[] dst, int offset, int length) has the following syntax.

public FloatBuffer get(float[] dst,  int offset,  int length)

Example

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

//  w w  w . j a  v  a  2 s.c o m
import java.nio.FloatBuffer;
import java.util.Arrays;

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,0,3);
    
    System.out.println(Arrays.toString(floatArray));

  }
}

The code above generates the following result.