Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.nio.IntBuffer;

public class Main {
    public static IntBuffer createIndexBuffer(int[] indices) {
        IntBuffer indexBuffer;

        ByteBuffer bb = ByteBuffer.allocateDirect(indices.length * 4);
        bb.order(ByteOrder.nativeOrder());
        indexBuffer = bb.asIntBuffer();
        indexBuffer.put(indices);
        indexBuffer.position(0);

        return indexBuffer;
    }
}