title: Java Array Comparison
body: <p>Working within Java, let's say I have two objects that, thanks to <code>obj.getClass().isArray()</code>, I know are both arrays.  Let's further say that I want to compare those two arrays to each other -- possibly by using <code>Arrays.equals</code>.  Is there a graceful way to do this without resorting to a big exhaustive if/else tree to figure out which flavor of <code>Arrays.equals</code> needs to be used?  I'm looking for something that's less of an eyesore than this:</p>
  
  <pre><code>
        if (obj1 instanceof byte[] && obj2 instanceof byte[]) {
           return Arrays.equals((byte[])obj1, (byte[])obj2);
        }
        else if (obj1 instanceof boolean[] && obj2 instanceof boolean[]) {
           ...
  </code></pre>