<p>I have two multidimensional arrays (well actually they're only 2D) which have inferred size. How do I deep clone them? Here's what I have gotten so far:</p>

<pre><code>public foo(Character[][] original){
    clone = new Character[original.length][];
    for(int i = 0; i &lt; original.length; i++)
          clone[i] = (Character[]) original[i].clone();
}
</code></pre>

<p>A test for equality <code>original.equals(clone);</code> spits out a false. Why? :|</p>

You might want to check out the
java.util.Arrays.deepEquals
and
java.util.Arrays.equals
methods.
I'm afraid the
```
equals
```
method for array objects performs a shallow comparison, and does not properly (at least for this case) compare the inner
```
Character
```
arrays.