import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.Collections;
import java.util.Comparator;
Map<String,Integer>map=new TreeMap<String,Integer>();
map.put("testNum", 100);
List<Entry<String,Integer>>lists=new ArrayList<Entry<String,Integer>>(map.entrySet());
Collections.sort(lists,new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1,Map.Entry<String, Integer> o2)
{
double q1=o1.getValue();
double q2=o2.getValue();
double p=q2-q1;
if(p>0){
return 1;
}
else if(p==0){
return 0;
}
else
return -1;
}
});
for(Map.Entry<String, Integer> set:lists){
System.out.println(set.getKey() +" "+set.getValue());
}
end