This is my code for a simple java game. How can I display the letters already guessed so they cannot guess the same letter twice. :     //import java.util;
    import java.util.Scanner;
 
    public class HangmanJava
     {
      public static void main(String[] args)    //creates an array
       {
        String input;
        boolean NotFullMan = true;    */runs when NotFullMan is true- all letters           haven't been guessed/*
        char guessedLetter = ' ';                          
        Scanner hm = new Scanner(System.in);
        System.out.println("Enter the hangman word");
        input = hm.nextLine();    */after word is entered, moves to next line and game begins/*
    
    
        //Convert String to CharArray 
    
        char[] charArray = input.toCharArray();            
//array tests characters
        StringBuffer buffer = new StringBuffer(input.length());              //stringbuffer so it can modified as needed
    
        int totalCorrect = 0;     
>>//created totalCorrect variable to help program end at the right time
    
        for (int i = 0; i < input.length(); i++)         
>>//buffer can be used as long as int is less than total length of word
          buffer.append('_');
     
        while (NotFullMan)
         {
         System.out.println("Enter a letter");
         guessedLetter = hm.nextLine().charAt(0);     
//starts game, player must guess a letter
         int correct = 0;
     
         for ( int i=0; i < charArray.length; i++)
           {                //Checks each letter
            if(guessedLetter == charArray[i] && buffer.charAt(i) == '_')
             { 
             correct++;
             totalCorrect++;                        > //totalCorrect so it can keep track
             buffer.setCharAt(i, guessedLetter);
             }
          }
          System.out.println("You got " + correct + " correct!");
          System.out.println(buffer.toString());
      
      
          if (totalCorrect == input.length())    >   //ends when totalCorrect is equal to the number of characters in word
             return;
      
        }
        }
     }