implement the Comparable interface to your class, then write a compareTo() method. Afterwards you can then determine what object you want to return.