areDeepMirrors

Category: Arrays
Author: Brett Wortzman
Book Chapter: 7.1
Problem: areDeepMirrors
Assume the following method exists:

     // returns true if the two integers are mirrors of each other
     // (i.e. one has the same digits in reverse order of the other)
     public static boolean areMirrors(int num1, int num2)

For example:

     +----------------------+---------+
     | Call                 | Returns |
     +----------------------+---------+
     | areMirrors(3, 3)     | true    |
     +----------------------+---------+
     | areMirrors(321, 123) | true    |
     +----------------------+---------+
     | areMirrors(25, 50)   | false   |
     +----------------------+---------+
     | areMirrors(101, 101) | true    |
     +----------------------+---------+

Write a static method areDeepMirrors that takes two integer arrays as parameters and returns true if the two arrays are deep mirrors of each other. Two integer arrays are deep mirrors of each other if each contains the mirrors of the elements of the other in reverse order. The following table shows some sample calls to areDeepMirrors, assume the call is areDeepMirrors(arr1, arr2):

     +------------------+-----------------+--------------+
     | arr1 value       | arr2 value      | Return Value |
     +------------------+-----------------+--------------+
     | [ 123, 321 ]     | [ 123, 321 ]    | true         |
     +------------------+-----------------+--------------+
     | [ 1, 2, 3 ]      | [ 3, 2, 1 ]     | true         |
     +------------------+-----------------+--------------+
     | [ 12, 5, 71 ]    | [ 17, 5, 21 ]   | true         |
     +------------------+-----------------+--------------+
     | [ 15, 10 ]       | [ 10, 15 ]      | false        |
     +------------------+-----------------+--------------+
     | [ 12, 11, 13 ]   | [ 21, 11, 31 ]  | false        |
     +------------------+-----------------+--------------+
     | [ 7 ]            | [ 7 ]           | true         |
     +------------------+-----------------+--------------+