import java.util.Scanner; public class RemoveElement { static Scanner s = new Scanner(System.in); public static void main(String[] args) { int[] newArray = buildArray(); System.out.println("Enter index to remove from array"); int r = s.nextInt(); System.out.println("Before removing index " + r); outputArray(newArray); newArray = remove(r, newArray); System.out.println("\nAfter removing index " + r); outputArray(newArray); } public static int [] buildArray() { Scanner s = new Scanner(System.in); System.out.println("Enter number of elements in the array"); int numElements = s.nextInt(); int [] arr = new int[numElements]; for(int x = 0; x < numElements; x++) { System.out.println("Enter element at index " + x); arr[x] = s.nextInt(); } return arr; } public static int [] remove(int i, int[] nums) { //This method should create and return a new array which is the same as the received nums array, // except that the element at index i is removed. } public static void outputArray(int [] n) { // This method should output the contents of the received array, n, in the following format // New array contents are {12, 2, 3} } }