why is the array "matrix[0]" sorted too, Systemcopy required?
int[] check = matrix[0];
Arrays.sort(check);
Now I use Systemcopy to Fix this, but why?
why is the array "matrix[0]" sorted too, Systemcopy required?
int[] check = matrix[0];
Arrays.sort(check);
Now I use Systemcopy to Fix this, but why?
This line: int[] check = matrix[0] assigns a reference of the matrix[0] to check.  Which means that whatever operation you do on check will be reflected in the matrix as well.  Though the references are not the same, the memory locations are, unless you create a copy (like you mentioned).
 
    
    When you do int[] check = matrix[0], check is now referencing matrix[0]. To make them two different arrays you need to make a deep copy.
