Android IntBuffer Create makeIntBuffer(int size)

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

Description

make Int Buffer

Declaration

public static IntBuffer makeIntBuffer(int size) 

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   ww w.  j a  va 2 s . c  o  m
        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 capacity)
  2. createIntBuffer(int count)
  3. createIntBuffer(int size)
  4. createIntBuffer(int[] data)
  5. getIntegerBuffer(int[] list)
  6. makeIntBuffer(int[] arr)
  7. newIntBuffer(int numInts)
  8. newIntBuffer(int numInts)
  9. newIntBuffer(int paramInt)