Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static int[] remove(int[] array, int index) {
        if (array == null || array.length == 0) {
            throw new IllegalArgumentException();
        }
        if (index > array.length || index <= 0) {
            throw new IllegalArgumentException();
        }
        int[] dest = new int[array.length - 1];
        System.arraycopy(array, 0, dest, 0, index - 1);
        System.arraycopy(array, index, dest, index - 1, array.length - index);
        return dest;
    }
}