Expanding an Array
import java.lang.reflect.Array; public class Main { public static void main(String[] argv) throws Exception { int[] array = { 1, 2, 3 }; Object newArray = Array.newInstance(array.getClass().getComponentType(), Array.getLength(array) * 2); System.arraycopy(array, 0, newArray, 0, Array.getLength(array)); } }