### Question:
PPSort { public static HashMap<String, Float> sortedToHashMap(HashMap<String, Float> temp, int N) { List<Map.Entry<String, Float>> resulttemp = new ArrayList<>(temp.entrySet()); Collections.sort(resulttemp, new Comparator<Map.Entry<String, Float>>() { @Override public int compare(Map.Entry<String, Float> o1, Map.Entry<String, Float> o2) { return (int) (o2.getValue() - o1.getValue()); } }); HashMap<String, Float> sortedtemp = new HashMap<>(); for (int k = 0; k < Math.min(temp.size(), N); k++) { String[] t = resulttemp.get(k).toString().split("="); sortedtemp.put(t[0], Float.parseFloat(t[1])); } return sortedtemp; }  static String[] sortedToStrings(HashMap<String, Integer> temp); static HashMap<String, Float> sortedToHashMap(HashMap<String, Float> temp, int N); static HashMap<String, Integer> sortedToHashMapInteger(HashMap<String, Integer> temp, int N); static int getMaxId(int[] array); static List<HashMap<String, String>> sortedToDoubleMap(HashMap<String, Long> temp,
			String keyname1, String keyname2, int num);  }### Answer:
@Test public void testSortedMapToList() { HashMap<String, Float> data = new HashMap<>(); data.put("aaa", 2.2f); data.put("bbb", 4.4f); data.put("ccc", 3.3f); assertEquals("{aaa=2.2, ccc=3.3, bbb=4.4}", PPSort.sortedToHashMap(data, 3).toString()); assertEquals("{ccc=3.3, bbb=4.4}", PPSort.sortedToHashMap(data, 2).toString()); assertEquals("{bbb=4.4}", PPSort.sortedToHashMap(data, 1).toString()); }