int daysInNonLeapYear = 365; int daysInLeapYear = 366; if (year % 400 == 0) { System.out.println("Number of days in the year: " + daysInLeapYear + "."); } else if (year % 100 == 0) { System.out.println("Number of days in the year: " + daysInNonLeapYear + "."); } else if (year % 4 == 0) { System.out.println("Number of days in the year: " + daysInLeapYear + "."); } else { System.out.println("Number of days in the year: " + daysInNonLeapYear + "."); }