title: Day of week function not working
body: <p>I'm trying to create a function where given a year where <code>year &gt; 1999</code> and it returns a value 0 through 6 where <code>Sunday = 0, Monday = 1 ... Saturday = 6</code> that corresponds to the day of the week that the first day of November is on. Since I know November 1, 2000 is 3 (Wednesday) I use that as <code>NOV1</code>. I know I have to keep leap years in mind so I have an <code>if</code> statement that will help. I don't know why it doesn't work properly for years greater than 2100. Help!</p>
  
  <pre><code>public static int firstOfMonth(int year)
  {
    int raw = year - 2000;
    int leapYears = raw / 4;
    int nonLeapYears = 0;
    if ( raw &gt;= 100 )
    {
      nonLeapYears = raw / 100;
      leapYears = leapYears - ( nonLeapYears - ( nonLeapYears / 4 ) );
    }
    else
    {
      nonLeapYears = 0;
    }
    return ((( NOV1 + ( raw * 365 ) - leapYears) ) % 7 );
  }
  </code></pre>
  
  <p>again, NOV1 = 3</p>