Java IntBuffer Create createIntBufferOnHeap(final int size)

Here you can find the source of createIntBufferOnHeap(final int size)

Description

Create a new IntBuffer of the specified size.

License

Open Source License

Parameter

Parameter Description
size required number of ints to store.

Return

the new IntBuffer

Declaration

public static IntBuffer createIntBufferOnHeap(final int size) 

Method Source Code

//package com.java2s;
/**//  w w  w.jav a2s.c o m
 * Copyright (c) 2008-2012 Ardor Labs, Inc.
 *
 * This file is part of Ardor3D.
 *
 * Ardor3D is free software: you can redistribute it and/or modify it 
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
 */

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

import java.nio.IntBuffer;

public class Main {
    /**
     * Create a new IntBuffer of the specified size.
     * 
     * @param size
     *            required number of ints to store.
     * @return the new IntBuffer
     */
    public static IntBuffer createIntBufferOnHeap(final int size) {
        final IntBuffer buf = ByteBuffer.allocate(4 * size).order(ByteOrder.nativeOrder()).asIntBuffer();
        buf.clear();
        return buf;
    }
}

Related

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