@Test public void test_daysInAMonth() throws Exception { assertEquals(31, daysInAMonth(2014, 1)); assertEquals(28, daysInAMonth(2014, 2)); assertEquals(31, daysInAMonth(2014, 3)); assertEquals(30, daysInAMonth(2014, 4)); assertEquals(31, daysInAMonth(2014, 5)); assertEquals(30, daysInAMonth(2014, 6)); assertEquals(31, daysInAMonth(2014, 7)); assertEquals(31, daysInAMonth(2014, 8)); assertEquals(30, daysInAMonth(2014, 9)); assertEquals(31, daysInAMonth(2014, 10)); assertEquals(30, daysInAMonth(2014, 11)); assertEquals(31, daysInAMonth(2014, 12)); assertEquals(29, daysInAMonth(2016, 2)); }
public static int daysInAMonth(int year, int month) { return 31 - ((month == 2) ? (3 - (isLeapYear(year) ? 1 : 0)) : ((month - 1) % 7 % 2)); }
Dint { public static int daysInAMonth(int year, int month) { return 31 - ((month == 2) ? (3 - (isLeapYear(year) ? 1 : 0)) : ((month - 1) % 7 % 2)); } }
Dint { public static int daysInAMonth(int year, int month) { return 31 - ((month == 2) ? (3 - (isLeapYear(year) ? 1 : 0)) : ((month - 1) % 7 % 2)); }  }
Dint { public static int daysInAMonth(int year, int month) { return 31 - ((month == 2) ? (3 - (isLeapYear(year) ? 1 : 0)) : ((month - 1) % 7 % 2)); }  static int create(int year, int month, int day); static int create(Calendar calendar); static int create(Date date); static int compose(int year, int month, int day); static int year(int dint); static int month(int dint); static int day(int dint); static Calendar toCalendar(int dint); static Date toDate(int dint); static int today(); static int firstDayOfMonth(int dint); static int lastDayOfMonth(int dint); static int daysInAMonth(int year, int month); static boolean isLeapYear(int year); static int diff(int dint1, int dint2); static int addYears(int dint, int years); static int addYearsExtend(int dint, int years); static int addMonths(int dint, int add); static int addMonthsExtend(int dint, int add); static int addDays(int dint, int days); }
Dint { public static int daysInAMonth(int year, int month) { return 31 - ((month == 2) ? (3 - (isLeapYear(year) ? 1 : 0)) : ((month - 1) % 7 % 2)); }  static int create(int year, int month, int day); static int create(Calendar calendar); static int create(Date date); static int compose(int year, int month, int day); static int year(int dint); static int month(int dint); static int day(int dint); static Calendar toCalendar(int dint); static Date toDate(int dint); static int today(); static int firstDayOfMonth(int dint); static int lastDayOfMonth(int dint); static int daysInAMonth(int year, int month); static boolean isLeapYear(int year); static int diff(int dint1, int dint2); static int addYears(int dint, int years); static int addYearsExtend(int dint, int years); static int addMonths(int dint, int add); static int addMonthsExtend(int dint, int add); static int addDays(int dint, int days);  }