Java IO Tutorial - Java IntBuffer.get(int[] dst, int offset, int length)








Syntax

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

public IntBuffer get(int[] dst,  int offset,  int length)

Example

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

import java.nio.IntBuffer;
import java.util.Arrays;
/*from   w  ww.j a v a 2  s. c  om*/
public class Main {
  public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);
    
    bb.rewind();
    
    int[] intArray = new int[10];
    bb.get(intArray,0,2);
    
    System.out.println(Arrays.toString(intArray));

  }
}

The code above generates the following result.