View difference between Paste ID: NUm8ckWL and 4YkpXT7Z
SHOW: | | - or go back to the newest paste.
1
public static void rotateArray(int[] arr, int rotate) 
2
	{
3
		int aLength = arr.length;
4
 		
5
		System.out.println(arr);
6
7
		for(int i = 0 ; i < rotate ; ++i)
8
		{
9
			int temp = arr[aLength - 1];
10
 
11
			for(int u = aLength - 1 ; u > 1 ; --u)
12
			{
13
				arr[u] = arr[u-1];
14
			}
15
 
16
			arr[0] = temp;
17
		}
18
19
		System.out.println(arr);
20
21
	}