Java IO Tutorial - Java DoubleBuffer.wrap(double[] array, int offset, int length)








Syntax

DoubleBuffer.wrap(double[] array, int offset, int length) has the following syntax.

public static DoubleBuffer wrap(double[] array,  int offset,  int length)

Example

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

import java.nio.DoubleBuffer;
import java.util.Arrays;
//from  w  w w. j av a 2s .c  om
public class Main {
  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.wrap(new double[]{98765,98765},0,1);

    
    bb.rewind();
    
    System.out.println(Arrays.toString(bb.array()));
  }
}

The code above generates the following result.