ArrayList<Entry<String,Long>> list = new ArrayList<Entry<String,Long>>(sMap.entrySet());
Collections.sort(list, new Comparator<Object>(){
public int compare(Object e1, Object e2){
int v1 = Integer.parseInt(((Entry<String,Long>)e1).getValue().toString());
int v2 = Integer.parseInt(((Entry)e2).getValue().toString());
return v2-v1;
}
});
for (Entry<String, Long> e : list){
System.out.println(e.getKey()+" "+e.getValue());