Here you can find the source of newInstance(final Class
@SuppressWarnings("unchecked") public static <T> T newInstance(final Class<T> arrayClass, final int length)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Array; public class Main { @SuppressWarnings("unchecked") public static <T> T newInstance(final Class<T> arrayClass, final int length) { if (!arrayClass.isArray()) { throw new IllegalArgumentException("not an array"); }/*from w w w . j ava 2 s. c o m*/ return (T) Array.newInstance(arrayClass.getComponentType(), length); } }