Import Java. io. file; import Java. util. arraylist; import Java. util. collections; import Java. util. comparator; import Java. util. hashmap; import Java. util. list; import Java. util. map; import Java. util. map. entry; public class statics {/*** stores the search keyword and the corresponding search times */private Map <string, integer> keywordmap = new hashmap <string, integer> (); /*** add search keyword ** @ Param keyword */Public void addkeyword (string keyword) {If (keywordmap. containskey (keyword) {int num = keywordmap. get (keyword); num ++; keywordmap. put (keyword, num);} else {keywordmap. put (keyword, 1) ;}/ *** sort by value, from large to small ** @ Param keywordmap * hashmap * @ return */public list of search keywords <entry <string, integer> sortkeywordmap (Map <string, integer> keywordmap) {list <entry <string, integer> arraylist = new arraylist <entry <string, integer> (keywordmap. entryset (); collections. sort (arraylist, new comparator <entry <string, integer> () {public int compare (Entry <string, integer> E1, entry <string, integer> E2) {return (e2.getvalue ()). compareto (e1.getvalue () ;}}); For (Entry <string, integer> entry: arraylist) {system. out. println (entry. getkey () + "" + entry. getvalue ();} return arraylist;}/*** sorts the hashmap of the Search Keyword by value, from large to small ** @ return */public list <entry <string, integer> sortkeywordmap () {return sortkeywordmap (keywordmap );}