public static void main(String[] args) {

        final int daysInWeek = 7;
        final int months = 12;
        final String[] weekDays = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
        final String[] monthNames = new String[]{"January", "February", "March", "April", "May", "June", "Julyl", "August", "September", "October", "November", "December"};

        int sundaysOfInterest = 0;
        int days = 1; // running week day counter
        int day = 0; // starting day of month
        int month = 0; // starting month
        int year = 1900; // starting year
        while (year < 2001) {

            // check if Sunday on the first of month
            final int weekday = days % daysInWeek;
//            System.out.println(weekDays[weekday] + "\t" + day + "\t" + monthNames[month] + "\t" + month + "\t" + year);
            if (day == 0 && weekday == 0) {
                if (year > 1900 && year < 2001) {
                    System.out.println(weekDays[weekday] + "\t" + day + "\t" + monthNames[month] + "\t" + month + "\t" + year);
                    sundaysOfInterest++;
                }
            }

            // increase day
            day++;
            days++;

            // check for change of month
            int daysInMonth = getDaysInMonth(month, year);
            if (day == daysInMonth) { // zero based days
                day = 0;
                month++;
            }

            // check if year changes
            if (month == months) { // zero based months
                year++;
                month = 0;
            }
        }

        System.out.println("# number of Sundays = " + sundaysOfInterest);
    }