public int[] addToArray(int[] arr, int item){ int[] newArr = new int[arr.length + 1]; for (int i = 0; i < arr.length; i++) { newArr[i] = arr[i]; } newArr[newArr.length - 1] = item; return newArr; }