• + 1 comment

    Can you guys explain to me this line

    if(idx-rot>=0)
                  System.out.println(arr[idx-rot]);
               else
                System.out.println(arr[idx-rot+arr.length]);
    

    I don't understand why it can refer to the roation element of array?