Java examples for java.nio:IntBuffer
allocate Int Buffer
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { public static void main(String[] argv) throws Exception { int numInts = 2; System.out.println(allocateIntBuffer(numInts)); }//from w w w. j a va2s . c o m public static IntBuffer allocateIntBuffer(int numInts) { ByteBuffer bb; int allocationSize = 4 * numInts; bb = ByteBuffer.allocateDirect(allocationSize); bb.order(ByteOrder.LITTLE_ENDIAN); return bb.asIntBuffer(); } }