Penso che potresti provare a fare una cosa del genere!
codice:
import java.util.HashMap;
import java.util.Collection;
import java.util.Arrays;
import java.util.Iterator;
public class Prova {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
HashMap<String, Integer> hm = new HashMap<String, Integer>();
hm.put("cinque", 5);
hm.put("tre", 3);
hm.put("otto", 8);
hm.put("uno", 1);
Object[] values = hm.values().toArray();
Arrays.sort(values);
for(int i=0; i<values.length; i++){
Iterator it = hm.keySet().iterator();
while(it.hasNext()){
String k = (String)it.next();
if((Integer)hm.get(k) == values[i] )
System.out.println(k + " " + (Integer)values[i]);
}
}
}
}