Java IO Tutorial - Java FloatBuffer.wrap(float[] array, int offset, int length)








Syntax

FloatBuffer.wrap(float[] array, int offset, int length) has the following syntax.

public static FloatBuffer wrap(float[] array,  int offset,  int length)

Example

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

import java.nio.FloatBuffer;
import java.util.Arrays;
/*from w ww  .  j  a v a2  s .  c  om*/
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.wrap(new float[]{1.23F},0,1);
    
    floatBuffer.rewind();
    
    System.out.println(Arrays.toString(floatBuffer.array()));

  }
}

The code above generates the following result.