Java IO Tutorial - Java FloatBuffer.put(float[] src, int offset, int length)








Syntax

FloatBuffer.put(float[] src, int offset, int length) has the following syntax.

public FloatBuffer put(float[] src,  int offset,  int length)

Example

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

import java.nio.FloatBuffer;
import java.util.Arrays;
//from w  w w.j  av a2s  .  c o m
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.allocate(10);
    
    floatBuffer.put(new float[]{1.23F,2.13F,3.13F,2.13F,},0,2);
    
    System.out.println(Arrays.toString(floatBuffer.array()));

  }
}

The code above generates the following result.