public Map<String, Integer> getSorted(Map<String, Integer> map) {
	List<Map.Entry<String, Integer>> list = new ArrayList<>(map.entrySet());

	Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
	    @Override
	    public int compare(Map.Entry<String, Integer> obj_1,
		    Map.Entry<String, Integer> obj_2) {
		return obj_2.getValue().compareTo(obj_1.getValue());
	    }
	});

	Map<String, Integer> res = new LinkedHashMap<>();

	for (Map.Entry<String, Integer> e : list) {
	    res.put(e.getKey(), e.getValue());
	}

	return res;
    }