class YourClass implements Comparable{
....
// return positive(+) , 0 , negative(-) for
// this is greater(>) than, equal to(=) or less than(<) the object to compare with
//e.g.:
public int compareTo(Object o){
hashCode() - ((YourClass)o).hashCode();
}
}