Java IO Tutorial - Java IntBuffer.allocate(int capacity)








Syntax

IntBuffer.allocate(int capacity) has the following syntax.

public static IntBuffer allocate(int capacity)

Example

In the following code shows how to use IntBuffer.allocate(int capacity) method.

import java.nio.IntBuffer;
/*from   w  ww .j  ava 2  s .  co  m*/
public class Main {
  public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);
    System.out.println(bb.arrayOffset());

  }
}

The code above generates the following result.