Android examples for java.nio:IntBuffer
int Array To IntBuffer
//package com.book2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { public static IntBuffer intArrayToBuffer(int[] intArray) { ByteBuffer byteBuffer = ByteBuffer .allocateDirect(intArray.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); IntBuffer intBuffer = byteBuffer.asIntBuffer(); intBuffer.put(intArray);/*from www . j a v a 2 s .c o m*/ intBuffer.position(0); return intBuffer; } }