Java DoubleBuffer.get(double[] dst, int offset, int length)

Syntax

DoubleBuffer.get(double[] dst, int offset, int length) has the following syntax.

public DoubleBuffer get(double[] dst,  int offset,  int length)

Example

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


import java.nio.DoubleBuffer;
import java.util.Arrays;
/*ww w  . j  av a 2 s  .c  o  m*/
public class Main {
  private static final int BSIZE = 10;

  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);
    bb.put(98765);
    
    bb.rewind();
    
    double[] doubleArray = new double[BSIZE];
    
    bb.get(doubleArray,0,2);
    
    System.out.println(Arrays.toString(doubleArray));

    
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer