Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Array;

public class Main {
    public static <T> T[] arrayAppend(Class<T> cls, T[] arr, T... append) {
        @SuppressWarnings("unchecked")
        T[] ret = (T[]) Array.newInstance(cls, arr.length + append.length);
        for (int i = 0; i < arr.length; i++)
            ret[i] = arr[i];
        for (int i = 0; i < append.length; i++)
            ret[i + arr.length] = append[i];
        return ret;
    }
}