1public class NewClass4 {
2 public static void main(String[] args)
3 {
4 HashMap<Integer,Integer>map=new HashMap<Integer, Integer>();
5 map.put(1, 50);
6 map.put(2, 60);
7 map.put(3, 30);
8 map.put(4, 60);
9 map.put(5, 60);
10 int maxValueInMap=(Collections.max(map.values())); // This will return max value in the Hashmap
11 for (Entry<Integer, Integer> entry : map.entrySet()) { // Itrate through hashmap
12 if (entry.getValue()==maxValueInMap) {
13 System.out.println(entry.getKey()); // Print the key with max value
14 }
15 }
16
17 }
18}