this is helpful for the rotation of arrays too where we do
int[] temp = temp[(i + rotations) % arr.length] = arr[i]
Sorry, I have used Java im super comfortable with java for problem solving because i have been using this for a year
anyways great blog