Java I/O How to - Create a LongBuffer








Question

We would like to know how to create a LongBuffer.

Answer

 /*from  w  w  w .ja v  a 2  s  .  c  o  m*/

import java.nio.ByteBuffer;
import java.nio.LongBuffer;

public class Main {
  public static void main(String[] argv) throws Exception {
    ByteBuffer buf = ByteBuffer.allocate(15);

    LongBuffer lbuf = buf.asLongBuffer();

  }
}