### Question:
MapUtils { public static HashMap<String, String> tranToRatio(HashMap<Integer, Integer> table) { HashMap<String, String> result = new HashMap<String, String>(); int sum = 0; Iterator<Integer> iterator = table.keySet().iterator(); while (iterator.hasNext()) { sum += table.get(iterator.next()); } iterator = table.keySet().iterator(); while (iterator.hasNext()) { Integer temp = iterator.next(); result.put(Integer.toString(temp), Float.toString((float) (Math.round(((float) table.get(temp) / sum) * 10000)) / 100) + "%"); } return result; }  static HashMap<String, String> tranToRatio(HashMap<Integer, Integer> table); static HashMap<Long, Integer> unionMaps(List<HashMap<Long, Integer>> table); static int getSum(HashMap<Long, Integer> table); static int[] getRealUses(HashMap<Long, Integer> table, int num); static String[] getRealRatio(HashMap<Long, Integer> table, int num); static int[] getRealCount(HashMap<Long, Integer> table, int num); static int getMaxKey(HashMap<Integer, String> map);  }### Answer:
@Test public void testTranToRatio() { assertEquals("{3=50.0%, 2=40.0%, 1=10.0%}", MapUtils.tranToRatio(test1).toString()); }