Here you can find the source of makeIntBuffer(int[] arr)
public static IntBuffer makeIntBuffer(int[] arr)
//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 w ww .j a v a2 s .com*/ 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; } }