Goldman Sachs interview question

How to sort the elements in arraylist and also how to reverse them?