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








Syntax

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

public static DoubleBuffer allocate(int capacity)

Example

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

import java.nio.DoubleBuffer;
//from   w w w.j a  v a2  s  . com
public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);
    System.out.println(bb.get());

  }
}

The code above generates the following result.