Here you can find the source of newInstanceWithFill(Class> componentType, int length, Object filledValue)
public static Object newInstanceWithFill(Class<?> componentType, int length, Object filledValue)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Array; public class Main { public static Object newInstanceWithFill(Class<?> componentType, int length, Object filledValue) { Object array = Array.newInstance(componentType, length); for (int i = 0; i < Array.getLength(array); i++) { Array.set(array, i, filledValue); }// w w w . j av a 2s .c o m return array; } }