The fastest way to do that is to sort by primary key (or creationdate) descending. Alternatively you can use this method:
while(controller.recordIndex < controller.getMaxRecordIndex())
{
controller.recordIndex = controller.getMaxRecordIndex()
}
The latter will be much slower.