Write a method printBackwards that prints an array of integers in reverse order, in the following format.
For the array {1, -3, 4, 7, 2}:
element [4] is 2
element [3] is 7
element [2] is 4
element [1] is -3
element [0] is 1
To write a method `printBackwards` that prints an array of integers in reverse order, you can start by defining the method signature in your code:
```
public static void printBackwards(int[] arr) {
// code goes here
}
```
Now, let's write the code to print the array in reverse order. We can use a for loop that iterates over the array in reverse, starting from the last element (`arr.length - 1`) and decrementing the index until it reaches zero.
Inside the loop, we can print each element of the array using the current index.
```
public static void printBackwards(int[] arr) {
for (int i = arr.length - 1; i >= 0; i--) {
System.out.println("element [" + i + "] is " + arr[i]);
}
}
```
You can call this method by passing your array as an argument, like this:
```
int[] arr = {1, -3, 4, 7, 2};
printBackwards(arr);
```
This will output:
```
element [4] is 2
element [3] is 7
element [2] is 4
element [1] is -3
element [0] is 1
```
By iterating over the array in reverse order and printing each element at the corresponding index, we achieve the desired output.