#4: Helper methods to handle array rotation.