Package com. demo. sw. test;/***** move the number in an array cyclically: * For example, number array: 1, 2, 3, 4, 5, 6, 7 * move the three digits forward and the result is: *, 6, 7, 1, 2, 3 * @ author Mr. J **/public class ArrayMove {public static void main (String [] args) {int [] arr = new int [12]; // initialize the array to be moved (int I = 0; I <arr. length; I ++) {arr [I] = I + 1;} int num = 17; // number of digits to move moveNums (arr, num ); // call the method to be moved // display the moving result System. out. println ("Call methods with returned values:"); for (int I = 0; I <arr. length; I ++) {System. out. print (arr [I] + "");} System. out. println ();}/** the method needs to be passed into the array to be moved and the moving displacement */public static int [] moveNums (int [] arr, int num) {if (num> arr. length) {// If the moving displacement is greater than the length of the array, the number of turns (num = num % arr. length;} // declare an array to store the number int [] copy = new int [num] That has been moved before the array; // store the numbers to be moved in the original array for (int I = 0; I <copy. length; I ++) {copy [I] = arr [I];} // move the array for (int I = 0; I <arr. length-num; I ++) {arr [I] = arr [I + num];} // After moving, append the original number to the back of the array for (int I = 0; I <copy. length; I ++) {arr [arr. length-num + I] = copy [I];} return arr ;}}