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








Syntax

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

public static LongBuffer allocate(int capacity)

Example

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

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

  }
}

The code above generates the following result.