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 

public class Main {
    /**
     * Returns the remainder byte array from the given index. The byte value on the
     * given index is <b>not</b> part of the result array.
     *
     * Returns an empty array, if the index is not within the array or it points to
     * the last element in the array.
     *
     * @param array
     * @param fromIndex
     * @return
     */
    public static byte[] subByteArray(byte[] array, int fromIndex) {
        if (fromIndex >= 0 && fromIndex < array.length - 1) {
            byte[] output = new byte[array.length - fromIndex - 1];
            System.arraycopy(array, fromIndex + 1, output, 0, array.length - fromIndex - 1);
            return output;
        }
        return new byte[0];
    }
}