Dint { public static int addMonths(int dint, int add) { int months = year(dint) * 12 + month(dint) - 1 + add; return composeLimit(dint, months / 12, months % 12 + 1); }  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);  }
@Test public void test_addMonths() throws Exception { assertEquals(20140912, addMonths(20140912, 0)); assertEquals(20140912, addMonths(20140812, 1)); assertEquals(20140912, addMonths(20141012, -1)); assertEquals(20140912, addMonths(20040912, 120)); assertEquals(20140912, addMonths(20130912, 12)); assertEquals(20140912, addMonths(20150912, -12)); assertEquals(20140912, addMonths(20240912, -120)); assertEquals(20140930, addMonths(20140831, 1)); }