Answer:
The method is as follows:
public static int lastIndexOf(int [] numbers, int num){
int lastIndex = numbers[0];
for(int i =0; i<numbers.length;i+=num){
lastIndex = numbers[i];
}
return lastIndex;
}
Step-by-step explanation:
This defines the method
public static int lastIndexOf(int [] numbers, int num){
This initializes the lastIndex to the first element of the array
int lastIndex = numbers[0];
This iterates through every "num" element of the array
for(int i =0; i<numbers.length;i+=num){
This gets the current index... until the last
lastIndex = numbers[i]; }
This returns the last
return lastIndex; }