Your best bet is to write a wrapper for this.
public class AddressWrapper implements Comparable {
public Address address;
public Integer counter;
public AddressWrapper(Address address, Integer counter) {
this.address = address;
this.counter = counter;
}
public Integer compareTo(Object other) {
return counter-((AddressWrapper)other).counter;
}
}
Which you would then populate:
AddressWrapper[] addressList = new AddressWrapper[0];
for(Address key: addresses.keyset()) {
addressList.add(new AddressWrapper(key, addresses.get(key));
}
addressList.sort();
// addressList[0].address contains the most used address