Explore BrainMass

Accessing Array Elements in Reverse Order

Write the definition of a method, isReverse , whose two parameters are arrays of integers of equal size. The method returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.)

So, suppose you had two int arrays, forward and backward, each with 4 elements. Now suppose that forward had these elements: 1, 2, 3, 4 and that backward had these: values 4, 3, 2, 1.

Then if your isReverse method were invoked, passing it forward and backward, it would return true.

Please explain in detail to aid learning process

Solution Preview

The idea is to check the first element of array A with the last element of array B if they ...

Solution Summary

Solution is a Java file ReverseArray.java which demonstrates how to check if an Array is in reverse order of another Array.