title: runs properly in netbeans but not in command prompt
body: <p>Edit: I'm not allowed to use scanner. I know, its better.</p>
  
  <p>The purpose of this program is to accept a leap four digit integer from the user and determine whether or not it is a leap year, inform the user of the result, and then prompt to reset the program to accept another entry. If the user enters a date before the year 1582 AD, it will be denied.</p>
  
  <pre><code>public class RevisedLeapYear {
      public static void main(String args[])
      throws java.io.IOException {
  
      char restartChoice = 'y';
      int readCh, year=0, i;
      boolean isLeapYear;
  
      while(restartChoice == 'y' || restartChoice == 'Y'){
          System.out.print("Enter target year: ");
          for(i = 0; i &lt; 4; i++)//start for
          {
              readCh = (int)System.in.read();
              switch(i) //start switch
              {//converts in to 4 digits
                  case 0: year = (int)((readCh - 48) * 1000); break;
                  case 1: year = year + (int) ((readCh - 48) * 100); break;
                  case 2: year = year + (int) ((readCh - 48) * 10); break;
                  case 3: year = year + (int) (readCh - 48);
              }//end switch
      }//end for
          isLeapYear = ((year % 4 == 0) &amp;&amp; (year % 100 != 0) || (year % 400 == 0));
                  if(isLeapYear == true &amp;&amp; year &gt; 1581){
                  System.out.println(year + " is a Leap Year! What a time to be alive!");
              }
                  else if(isLeapYear == false &amp;&amp; year &gt; 1581){
                  System.out.println(year + " is not a Leap Year... how unfortunate.");
              }
              else{
                  System.out.println("There are no leap years before 1582!");
              }
      readCh = System.in.read(); // Clear the carriage return in the buffer
      readCh = System.in.read(); // Clear the linefeed in the buffer
  
      System.out.print("Reset program? y/n \n");
      restartChoice=(char)System.in.read(); //Clears restart choice from the buffer.
      year=(int)System.in.read(); //Clears year from the buffer.
  
      }              
  }//End main
  }//End class
  </code></pre>
  
  <p>The problem I am running in to is that in command prompt, no matter what the second entry is, it will always say its less than 1582. I had this same problem when I developed it in netbeans, and fixed it by clearing the buffer with "year=(int)System.in.read();". The program ran without a hitch after that, but now when running it with command prompt, the problem repeats.</p>
  
  <p>This is the result of trying to run 3 iterations of the program using the values 2916, 1900, and 1432.</p>
  
  <pre><code>///// In Netbeans
  
  Enter target year: 2916
  2916 is a Leap Year! What a time to be alive!
  
  Reset program? y/n 
  y
  Enter target year: 1900
  1900 is not a Leap Year... how unfortunate.
  
  Reset program? y/n 
  y
  Enter target year: 1432
  There are no leap years before 1582!
  
  Reset program? y/n 
  n
  BUILD SUCCESSFUL (total time: 49 seconds)
  
  ///// end of program
  
  ///// In command prompt
  
  Enter target year: 2916
  2916 is a Leap Year! What a time to be alive1
  Reset program? y/n
  y
  Enter target year: 1900
  There are no leap years before 1582!
  Reset program? y/n
  y
  
  ///// End of program
  </code></pre>
  
  <p>There are a few things wrong.
  1. It always thinks the user entered a # &lt; 1582 on the second run of the program.</p>
  
  <ol start="2">
  <li><p>In the netbeans run there are spaces after the result of whether or not the entry was a leap year where the user must press a key to continue to the reset prompt, for some reason command prompt bypasses by this. It isn't necessarily a problem, in fact it is better, but it might be linked to the problem.</p></li>
  <li><p>The program ends after the second iteration no matter what is entered in the reset prompt.</p></li>
  </ol>