Your question doesn't include enough information. We shouldn't suppose that matrix is 2D array. Also arrays.sorts doesn't really point to something everyone knows. Can you please edit the question?
int[] check = matrix[0] does not copy the array matrix[0], it just copies the reference to the array (i.e. it's a shallow copy). See also: stackoverflow.com/q/40480 . FYI, you can also use matrix[0].clone() to create a copy.
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).
matrixis an array of references toint[]arrays, essentiallyint[]isn't a primitive type.matrixis 2D array. Alsoarrays.sortsdoesn't really point to something everyone knows. Can you please edit the question?int[] check = matrix[0]does not copy the arraymatrix[0], it just copies the reference to the array (i.e. it's a shallow copy). See also: stackoverflow.com/q/40480 . FYI, you can also usematrix[0].clone()to create a copy.