Set Interface Working

How do I make Set Interface work in the code below to find the max char.

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
String str = scn.nextLine();
}
public static char maxFreq(String str) {
HashMap<Character,Integer> map = new HashMap<>();
for(int i=0;i<str.length();i++) {
char cc = str.charAt(i);
if(map.containsKey(cc)) {
int ov = map.get(cc);
int nv = ov+1;
}else {
map.put(cc,1);
}
}
int max=0;
char maxChar=’\0’;
Set<Map.Entry<Character,Integer>> entries = map.entrySet();
for(Map.Entry<Character,Integer> entry : entries) {
if(map.getValue() > max) {
max = map.getValue();
maxChar = map.getKey();
}
}
return maxChar;
}
}

please share your code by saving it on ide.codingblocks.com

also a Better approach:
1.Declare an Array of 26 size to store the Freq of each character.

2.Each time any character is encountered increment its corresponding freq at that index.

3.Declare a max variable and put a loop on filled array.

4.Update the max and character accordingly.

you can refer to this