//This ResizingArray class allows you to add and remove elements as you wish. //Each time you do so, a new array is created at the correct size and all data //is copied over. //To simplify, there is a main method testing this class at the bottom. //Author: Patrick Campeau public class ResizingArray { public int[] data; public ResizingArray(int size) { data = new int[size]; } public void removeAt(int ind) { int[] b = new int[data.length-1]; for(int x = 0; x < ind; x++) //copy everything before ind { b[x] = data[x]; } for(int x = ind; x < b.length; x++) //copy everything after ind { b[x]=data[x+1]; } data = b; } public void insertEnd(int val) { int[] b = new int[data.length + 1]; for (int i = 0; i < data.length; i++) { b[i] = data[i]; } int lastIndex = data.length; b[lastIndex] = val; data = b; } public int getAt(int ind) { return data[ind]; } public void setAt(int ind, int val) { data[ind] = val; } public String toString() { String s = "["; for (int x=0; x