Java tutorial
//package com.java2s; import java.util.*; public class Main { public static List sortMapByValueDESC(Map map) { List list = new ArrayList(map.entrySet()); Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) ((Map.Entry) (o2)).getValue()).compareTo(((Map.Entry) (o1)).getValue()); } }); return list; } }