Here you can find the source of buildIntBuffer(int[] buffer)
Parameter | Description |
---|---|
buffer | a parameter |
public static IntBuffer buildIntBuffer(int[] buffer)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { /**/*from ww w . ja v a2 s . c om*/ * build IntBuffer: int[] -> IntBuffer * * @param buffer * @return IntBuffer */ public static IntBuffer buildIntBuffer(int[] buffer) { IntBuffer ret = null; if (buffer != null) { ByteBuffer byteBuffer = ByteBuffer .allocateDirect(buffer.length * 4); byteBuffer.order(ByteOrder.nativeOrder()); ret = byteBuffer.asIntBuffer(); ret.put(buffer); ret.position(0); } return ret; } }