I got to print them in groups but it got duplicated when using for loop.
for(int j = arr.length - 1; j >= 0; j--) { System.out.print("[" + arr[j