Android IntBuffer Create getIntegerBuffer(int[] list)

Here you can find the source of getIntegerBuffer(int[] list)

Description

Genera un IntBuffer a partir de un array de integers

Parameter

Parameter Description
lista de integers

Return

IntBuffer resultante

Declaration

public static IntBuffer getIntegerBuffer(int[] list) 

Method Source Code

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import java.nio.IntBuffer;

public class Main {
    /**/*w w  w.jav  a 2s  . c o m*/
     * Genera un IntBuffer a partir de un array de integers
     * @param lista de integers
     * @return IntBuffer resultante
     */
    public static IntBuffer getIntegerBuffer(int[] list) {
        ByteBuffer bb = ByteBuffer.allocateDirect(list.length
                * Integer.SIZE / 8);
        bb.order(ByteOrder.nativeOrder());
        IntBuffer ib = bb.asIntBuffer();

        ib.put(list);
        ib.position(0);
        return ib;
    }
}

Related

  1. newIntBuffer(int numInts)
  2. createIntBuffer(int capacity)
  3. createIntBuffer(int count)
  4. createIntBuffer(int size)
  5. createIntBuffer(int[] data)
  6. makeIntBuffer(int size)
  7. makeIntBuffer(int[] arr)
  8. newIntBuffer(int numInts)
  9. newIntBuffer(int numInts)