PackedLocalDate { public static int minusMonths(int months, int packedDate) { return plusMonths(-months, packedDate); }  static byte getDayOfMonth(int date); static short getYear(int date); static LocalDate asLocalDate(int date); static byte getMonthValue(int date); static int pack(LocalDate date); static int pack(short yr, byte m, byte d); static int pack(int yr, int m, int d); static String toDateString(int date); static int getDayOfYear(int packedDate); static boolean isLeapYear(int packedDate); static Month getMonth(int packedDate); static int lengthOfMonth(int packedDate); static long toEpochDay(int packedDate); static DayOfWeek getDayOfWeek(int packedDate); static int getQuarter(int packedDate); static boolean isInQ1(int packedDate); static boolean isInQ2(int packedDate); static boolean isInQ3(int packedDate); static boolean isInQ4(int packedDate); static boolean isAfter(int packedDate, int value); static boolean isEqualTo(int packedDate, int value); static boolean isBefore(int packedDate, int value); static boolean isOnOrBefore(int packedDate, int value); static boolean isOnOrAfter(int packedDate, int value); static boolean isDayOfWeek(int packedDate, DayOfWeek dayOfWeek); static boolean isSunday(int packedDate); static boolean isMonday(int packedDate); static boolean isTuesday(int packedDate); static boolean isWednesday(int packedDate); static boolean isThursday(int packedDate); static boolean isFriday(int packedDate); static boolean isSaturday(int packedDate); static boolean isFirstDayOfMonth(int packedDate); static boolean isInJanuary(int packedDate); static boolean isInFebruary(int packedDate); static boolean isInMarch(int packedDate); static boolean isInApril(int packedDate); static boolean isInMay(int packedDate); static boolean isInJune(int packedDate); static boolean isInJuly(int packedDate); static boolean isInAugust(int packedDate); static boolean isInSeptember(int packedDate); static boolean isInOctober(int packedDate); static boolean isInNovember(int packedDate); static boolean isInDecember(int packedDate); static boolean isLastDayOfMonth(int packedDate); static int withDayOfMonth(int dayOfMonth, int packedDate); static int withMonth(int month, int packedDate); static int withYear(int year, int packedDate); static int plusYears(int yearsToAdd, int packedDate); static int minusYears(int years, int packedDate); static int plusMonths(int months, int packedDate); static int minusMonths(int months, int packedDate); static int plusWeeks(int valueToAdd, int packedDate); static int minusWeeks(int valueToSubtract, int packedDate); static int plusDays(int days, int packedDate); static int minusDays(int days, int packedDate); static boolean isInYear(int next, int year); static int lengthOfYear(int packedDate); static int getWeekOfYear(int packedDateTime); static int plus(int valueToAdd, ChronoUnit unit, int packedDate); static int minus(int valueToAdd, ChronoUnit unit, int packedDate); static int daysUntil(int packedDateEnd, int packedDateStart); static int weeksUntil(int packedDateEnd, int packedDateStart); static int monthsUntil(int packedDateEnd, int packedDateStart); static int yearsUntil(int packedDateEnd, int packedDateStart);  }
@Test public void testMinusMonths() { LocalDate day = LocalDate.of(2011, 3, 9); int packed = pack(day); int day2 = minusMonths(4, packed); assertEquals(11, getMonthValue(day2)); assertEquals(2010, getYear(day2)); assertEquals(9, getDayOfMonth(day2)); }