How can i access specific value in a HashMap?
<p>This simple game asks for the number of the players and their names and counts their score.How can i get the player with the highest score?</p>

<p><strong>main:</strong></p>

<pre><code>  public static void main(String[] args) {


    Scanner scanner = new Scanner(System.in);
    HashMap&lt;String,Integer&gt; players= new HashMap&lt;String,Integer&gt;();

    System.out.printf("Give the number of the players: ");
    int numOfPlayers = scanner.nextInt();

    for(int k=1;k&lt;=numOfPlayers;k++)
    {
        System.out.printf("Give the name of player %d: ",k);
        String nameOfPlayer= scanner.next();
        players.put(nameOfPlayer,0);//score=0
    }

    //This for finally returns the score
    for(String name:players.keySet())
    {
          System.out.println("Name of player in this round: "+name);
          //::::::::::::::::::::::
          //::::::::::::::::::::::


          int score=players.get(name)+ p.getScore();;

          //This will update the corresponding entry in HashMap
          players.put(name,score);
          System.out.println("The Player "+name+" has "+players.get(name)+" points ");
    }
}
</code></pre>

<p>This what i tried myself:</p>

<pre><code>Collection c=players.values(); 
System.out.println(Collections.max(c)); 
</code></pre>
