Java IntBuffer Create createIntBuffer(int size)

Here you can find the source of createIntBuffer(int size)

Description

create Int Buffer

License

Apache License

Declaration

public static IntBuffer createIntBuffer(int size) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import java.nio.IntBuffer;

public class Main {
    public static IntBuffer createIntBuffer(int size) {
        return createByteBuffer(size * Integer.BYTES).asIntBuffer();
    }/*from  w w  w. jav a  2 s .  co  m*/

    public static IntBuffer createIntBuffer(int[] indices, boolean flipped) {
        IntBuffer buffer = createIntBuffer(indices.length);
        buffer.put(indices);

        if (flipped)
            buffer.flip();

        return buffer;
    }

    public static ByteBuffer createByteBuffer(int size) {
        return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());
    }
}

Related

  1. createIntBuffer(final int... data)
  2. createIntBuffer(final int... data)
  3. createIntBuffer(int capacity)
  4. createIntBuffer(int size)
  5. createIntBuffer(int size)
  6. createIntBuffer(int... data)
  7. createIntBuffer(int[] array)
  8. createIntBufferOnHeap(final int size)
  9. newDirectIntBuffer(final int theSize)