copy a 2d array in java
<p>i have a 2d array called matrix of type int that i want to copy to a local variable in a method so i can edit it </p>

<p>whats the best way to copy the array, i am having some troubles</p>

<p>for example</p>

<pre><code>    int [][] myInt;
    for(int i = 0; i&lt; matrix.length; i++){
        for (int j = 0; j &lt; matrix[i].length; j++){
            myInt[i][j] = matrix[i][j];
        }
    }

    //do some stuff here
    return true;
}
</code></pre>
