public class Test { public static void main(String[] args) { int array[] = { 4, 8, 9, 5, 1 }; // 9 5 1 4 8 Solution1 s = new Solution1(); s.rotateLeft(array,2); } } class Solution1 { public int[] rotateLeft(int a[],int x) { int a1[] = new int[a.length]; int k = (a.length + 1) - x; int j=0; int temp[] = new int[x-1]; /* for(int r=0; r <=k; r++) { temp[r]=a[k]; k--; } */ for(int i=x ;i