Java examples for java.nio:IntBuffer
allocate Direct IntBuffer
//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 size = 2; System.out.println(allocateDirectInt(size)); }/*from ww w .jav a2 s . co m*/ public static IntBuffer allocateDirectInt(int size) { ByteBuffer bb = ByteBuffer.allocateDirect(size * 4); bb.order(ByteOrder.nativeOrder()); return bb.asIntBuffer(); } }