HeapSort.sort( anArray, new BySalaryAndHireDateCompare()); ... class BySalaryAndHireDateCompare implements Compare { /** * return positive number if a > b, 0 if a = b, negative number if a < b */ int compare (Object a , Object b) { // compare descending salary, ascending hireDate Employee empa = (Employee) a; Employee empb = (Employee) b; if ( empa.salary > empb.salary ) return -1; if ( empa.salary < empb.salary ) return +1; return empa.hireDate - empb.hireDate; } // end method compare } // end class BySalaryAndHireDateCompare