import java.util.Calendar; import java.util.GregorianCalendar; public class CountingSundays { public static void main(String args[]) { Calendar cal = new
It should be
while( !(cal.get(Calendar.YEAR) == 2001 && cal.get(Calendar.MONTH) == 0 && cal.get(Calendar.DAY_OF_MONTH) == 1) ) { // while not 1/1/2001