Here you can find the source of createIntBuffer(int size)
Parameter | Description |
---|---|
size | The size, in ints |
public static IntBuffer createIntBuffer(int size)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { /**/*w ww. j ava2s . co m*/ * Construct a direct native-order intbuffer with the specified number * of elements. * @param size The size, in ints * @return an IntBuffer */ public static IntBuffer createIntBuffer(int size) { return createByteBuffer(size << 2).asIntBuffer(); } /** * Construct a direct native-ordered bytebuffer with the specified size. * @param size The size, in bytes * @return a ByteBuffer */ public static ByteBuffer createByteBuffer(int size) { return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); } }