Here you can find the source of makeIntBuffer(int size)
public static IntBuffer makeIntBuffer(int size)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { public static IntBuffer makeIntBuffer(int[] arr) { ByteBuffer bb = ByteBuffer.allocateDirect(arr.length * 4); bb.order(ByteOrder.nativeOrder()); IntBuffer Ib = bb.asIntBuffer(); Ib.put(arr);//from ww w. j a va 2 s . c o m Ib.position(0); return Ib; } public static IntBuffer makeIntBuffer(int size) { ByteBuffer bb = ByteBuffer.allocateDirect(size * 4); bb.order(ByteOrder.nativeOrder()); IntBuffer Ib = bb.asIntBuffer(); Ib.position(0); return Ib; } }