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 final int BYTES_PER_INT = 4;

    public static IntBuffer arrayToIntBuffer(int[] inputArray) {
        IntBuffer iBuf = ByteBuffer.allocateDirect(inputArray.length * BYTES_PER_INT).order(ByteOrder.nativeOrder())
                .asIntBuffer();
        iBuf.put(inputArray).position(0);
        return iBuf;
    }
}