RandomAccessBuffer.java

import java.nio.*;
public class RandomAccessBuffer {
  final static int SIZE=32;
  public static void main(String[] args) {
    IntBuffer ib = IntBuffer.allocate(SIZE);
    for (int i=0; i<SIZE; i++) {
      ib.put(i,2*i);
    }
    for (int i=0; i<SIZE; i++) {
      System.out.println(ib.get(i));
    }
  }
}