Java tutorial
//package com.java2s; import java.lang.reflect.Array; public class Main { @SuppressWarnings("unchecked") public static <T> T[] newArray(Class<T> arrayType, int length) { return (T[]) Array.newInstance(arrayType, length); } }