Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    static public int[] getArray(ByteBuffer data, int dataSize) {
        int size = data.getInt();
        int[] result = new int[size];
        for (int i = 0; i < result.length; i++) {
            if (dataSize == 2)
                result[i] = data.getShort();
            if (dataSize == 4)
                result[i] = data.getInt();
        }
        return result;
    }
}