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








Syntax

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

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

Example

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

import java.nio.IntBuffer;
import java.util.Arrays;
// w  w  w .  j  a va  2s .c o m
public class Main {
  public static void main(String[] args) {
    IntBuffer bb = IntBuffer.wrap(new int[] { 0, 1, 2, 3, 4, 5, 6 },0,3);
    bb.put(100);
    System.out.println(Arrays.toString(bb.array()));

  }
}

The code above generates the following result.