Java Shift Array Elements Javascript Interview