Android IntBuffer Create makeIntBuffer(int[] arr)

Here you can find the source of makeIntBuffer(int[] arr)

Description

make Int Buffer

Declaration

public static IntBuffer makeIntBuffer(int[] arr) 

Method Source Code

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

import java.nio.IntBuffer;

public class Main {
    public static IntBuffer makeIntBuffer(int[] arr) {
        ByteBuffer bb = ByteBuffer.allocateDirect(arr.length * 4);
        bb.order(ByteOrder.nativeOrder());
        IntBuffer Ib = bb.asIntBuffer();
        Ib.put(arr);/*from   w ww .j a v  a2 s .com*/
        Ib.position(0);
        return Ib;
    }

    public static IntBuffer makeIntBuffer(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(size * 4);
        bb.order(ByteOrder.nativeOrder());
        IntBuffer Ib = bb.asIntBuffer();
        Ib.position(0);
        return Ib;
    }
}

Related

  1. createIntBuffer(int count)
  2. createIntBuffer(int size)
  3. createIntBuffer(int[] data)
  4. getIntegerBuffer(int[] list)
  5. makeIntBuffer(int size)
  6. newIntBuffer(int numInts)
  7. newIntBuffer(int numInts)
  8. newIntBuffer(int paramInt)
  9. setupIntBuffer(IntBuffer preBuffer, int[] array)