copy3 is a shallow copy of Orig - actually just a pen name for Orig;
that is copy3 and Orig reference the address at which that array is stored.
To see this look at what happens when you change Orig.
Of course, before we start sorting, Orig, copy1 and copy2 are all identical.
LexSort is defined as copy1.sort()
Notice that copy1 has changed --- that is the sort changes the array on which it is called.
The same thing is true when we execute
realSort=copy2.sort(compareSort);
Again, copy2 is changed.
Actually, LexSort is just another name for copy1 and realSort is just another name for copy2 -
not surpising considering what happened with copy3