Java IO Tutorial - Java FloatBuffer.wrap(float[] array)








Syntax

FloatBuffer.wrap(float[] array) has the following syntax.

public static FloatBuffer wrap(float[] array)

Example

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

import java.nio.FloatBuffer;
import java.util.Arrays;
// w  w  w .  java2  s. c om
public class Main {
  public static void main(String[] args) {
    FloatBuffer floatBuffer = FloatBuffer.wrap(new float[]{1.23F});
    
    floatBuffer.rewind();
    
    System.out.println(Arrays.toString(floatBuffer.array()));

  }
}

The code above generates the following result.