/***
* From java doc: If the src and dest arguments refer to the same array object,
* then the copying is performed as if the components at positions srcPos through
* srcPos+length-1 were first copied to a temporary array with length components
* and then the contents of the temporary array were copied into positions destPos
* through destPos+length-1 of the destination array
*/
public class ArraycopyTest {
public static void main(String args[]) {
int[] scores = {1, 2, 3, 4, 5, 6};
System.arraycopy(scores, 2, scores, 3, 3);
for (int i : scores)
System.out.print(i);
}
}
123345
It‘s safe