There are a couple of approaches here.
You can to implement a Comparator, and then use this in the standard Java Collection lib to sort your collection e.g. Collections.sort()
Comparator<MyObject> comparator = ....
Collections.sort(listOfObjects, comparator); // note- will sort in place
An alternative is for your object to implement Comparable. This then introduces a native sort order to your object.
Note that you can implement both approaches simultaneously. The former is useful when you want to implement different sorting strategies (e.g. by name, by date, by size etc.). The latter is useful if you want to make use of the concept of native ordering and the standard sort functions within the Java lib.
Check out the Java tutorial on Object Ordering