Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String[] shift(String[] array) {
        return shift(array, 1);
    }

    public static String[] shift(String[] array, int n) {
        if (n <= 0) {
            throw new IllegalArgumentException("n must a non-negative number.");
        }

        if (n >= array.length) {
            return new String[0];
        }

        String[] dest = new String[array.length - n];
        System.arraycopy(array, n, dest, 0, array.length - n);
        return dest;
    }
}