Issues with Number of guesses doesn't update for a new try and the code causses errors when typing the number 1005,1006?
<p>Hey guys , thanx for the previous help
Before I try to explain my problem, you guys need to know what the code is about. Its pretty much "To write a game in which a user is to guess a random number between 1 and 1000. The program should read a number from the keyboard, and print whether the guess was too high, too low or correct. When the user has guessed correctly, the program prints out the numbe of guesses made and time and the playername.When a game is started the program must print the entire high score list, sorted by the number of guesses in ascending" </p>

<p>Everything works, but the problem is when I try typing the code  with 1005 and 1006 it causes errors. 
and the number of guesses doesn't update for a new try!  For the  number of guesses i tried to add a boolean statement but that didn't seem to work and for the numbers i couldn't find why it causes errors.
SO basically I'm pretty stuck, I was hoping that u guys could give me some pointers or some kind of help so I could fix the problem,,,,, Any help is appreciated....
BTW this is my first program, basically still in the learning phase So take it easy with the comments.
The code is below:</p>

<pre><code>import java.util.*;
import java.util.Scanner.*;
import java.util.ArrayList.*;
import java.util.Collections.*;


public class Game {
private static void start() {


 int tries = 0 ;

 int guess = -1;
 String name ;
 String quit = "quit";
 String y = "yes";
 String n = "no";
 String currentGuess;


 String another = ("y") ;
 Scanner input = new Scanner (System.in);

ArrayList&lt;Integer&gt; score = new ArrayList&lt;Integer&gt;();
ArrayList&lt;Long&gt; tg = new ArrayList&lt;Long&gt;();
ArrayList&lt;String&gt; playern = new ArrayList&lt;String&gt;();



boolean a=false;

  do {
      a=false;
     int answer = (int) (Math.random() * 1000 + 1) ;
    System.out.println( " Welcome to Guessing Game " ) ;
    System.out.print("Please enter a number between 1 and 1000 : ");
                    currentGuess = input.nextLine();
      long startTime = System.currentTimeMillis();





      do
      {


               if (currentGuess.equalsIgnoreCase(quit))
  {
   System.out.println("Leaving Us So Soon?");
   System.exit(0);
  }

               try    {
   guess = Integer.parseInt(currentGuess);
        } catch (NumberFormatException nfe) 
                        {
   System.out.println(" Dude Can You Read, Only Digits ");
                        currentGuess = input.nextLine();


   }

  if (guess &lt; 1 || guess &gt; 1000)
  {
   System.out.println("Stupid Guess I Wont Count That.");
                        currentGuess = input.nextLine();

  }
       if (guess &lt; answer )
          {
   System.out.println("too low "+answer);
   currentGuess = input.nextLine();
                        tries++;
  }


    else if(guess  &gt; answer )
  {
   System.out.println("too high "+answer);
   currentGuess = input.nextLine();
                        tries++;
  }


    else if (guess == answer)
  {       
   //stop stop watch
   long endTime = System.currentTimeMillis();
   //calculate game time
   long gameTime = endTime - startTime;
                        gameTime = (gameTime/1000);
   System.out.println("You Rock Dude, Good Job!");


                        System.out.println("You guessed " + tries + " times in " + (int)(gameTime/1000) + " seconds.");
                        System.out.println("Please enter your name.");
                          name = input.nextLine();

                          score.add(tries) ;
                          playern.add(name);
                          tg.add(gameTime);

                          for ( int g=0; g &lt; score.size()-1; g++){
                              for ( int b=g+1; b &lt; score.size(); b++){
                                  if (score.size()&gt;1){
                                  if  (score.get (g) &gt; score.get (b)){
                                    Collections.swap(score, g, b);
                                    Collections.swap(playern, g, b);
                                    Collections.swap(tg, g, b);

                                  }
                                  }
                                  if (score.get (g)==score.get(b) &amp;&amp; tg.get (g) &gt; tg.get(b))
                                  {
                                    Collections.swap(score, g, b);
                                    Collections.swap(playern, g, b);
                                    Collections.swap(tg, g, b);
                                  }
                              }

                          }



             boolean s = false  ; 
             while (s==false)
              {


                     System.out.print("Want to go again?(y/n).....");
                     currentGuess = input.nextLine();
                      if (currentGuess.matches("y"))
   {

                        System.out.println("HighScore:");
                        System.out.println("Tries\tTimentName");
                     for (int j=0; j&lt;score.size(); j++){
                    System.out.println(score.get(j) +"\t"+tg.get(j)+ "\t"+playern.get(j));
                            }


    }

                     s=true;

   }

               //if user doesn't want to play again

                             if (currentGuess.matches("n"))
                             { System.out.println("HighScore:");
                               System.out.println("Tries\tTime\t\tName");
       for (int j=0; j&lt;score.size(); j++){
    System.out.println(score.get(j) +"\t"+tg.get(j)+ "\t"+playern.get(j));
                            }


                                System.out.println("Thanx For Playing.");
    a=true;

                                s=true;
                                 System.exit(0);  
                    } 
       }



        } while (guess != answer);

  }while(a==false);

}

public static void main(String[] args) {

    Game.start();
    }
}
</code></pre>
