Integer numScores is read from input, representing the number of integers to be read next. Then, the remaining integers are read and stored into array scoresList. Write a loop that assigns array rotatedList with scoresList's elements shifted to the left by one index. The element at index 0 of scoresList should be copied to the end of rotatedList.

Ex: If the input is:

3
105 40 20
then the output is:

Original scores: 105 40 20
Updated scores: 40 20 105
import java.util.Scanner;

public class ArrayModification {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int[] scoresList;
int[] rotatedList;
int numScores;
int i;

numScores = scnr.nextInt();

scoresList = new int[numScores];
rotatedList = new int[numScores];

for (i = 0; i < scoresList.length; ++i) {
scoresList[i] = scnr.nextInt();
}

for (i = 0; i < numScores; i++) {
rotatedList[(i + 1) % numScores] = scoresList[i];
}
rotatedList[0] = scoresList[numScores - 1];

System.out.print("Original scores: ");
for (i = 0; i < scoresList.length; ++i) {
System.out.print(scoresList[i] + " ");
}
System.out.println();

System.out.print("Updated scores: ");
for (i = 0; i < rotatedList.length; ++i) {
System.out.print(rotatedList[i] + " ");
}
System.out.println();
}
}