public static int [] lengthen(int [] a, int add) { int [] b = new int [a.length + add]; for(int i = 0; i < b.length; i++) { if(i < a.length) { b[i] = a[i]; } else { System.out.println("Called at " + i); b[i] = 1; } } return b; } public static void main(String [] args) { int [] dataSet = {5, 2, 9, 11, 0}; int addLength = 10; int [] x = lengthen(dataSet, addLength); } /* with some printing stuff I do elsewhere in the code it returns: The original data set is: the length is 5 5, 2, 9, 11, 0, The lengthen method makes the original data look like this: Called at 5 Called at 6 Called at 7 Called at 8 Called at 9 Called at 10 Called at 11 Called at 12 Called at 13 Called at 14 the length is 5 5, 2, 9, 11, 0, */