question: public long add ( long instant , int months ) { if ( months == 0 ) { return instant ; } long timePart = iChronology . getMillisOfDay ( instant ) ; int thisYear = iChronology . getYear ( instant ) ; int thisMonth = iChronology . getMonthOfYear ( instant , thisYear ) ; int yearToUse ; int monthToUse = thisMonth - 1 + months ; if ( monthToUse >= 0 ) { yearToUse = thisYear + ( monthToUse / iMax ) ; monthToUse = ( monthToUse % iMax ) + 1 ; } else { yearToUse = thisYear + ( monthToUse / iMax ) - 1 ; monthToUse = Math . abs ( monthToUse ) ; int remMonthToUse = monthToUse % iMax ; if ( remMonthToUse == 0 ) { remMonthToUse = iMax ; } monthToUse = iMax - remMonthToUse + 1 ; if ( monthToUse == 1 ) { yearToUse += 1 ; } } int dayToUse = iChronology . getDayOfMonth ( instant , thisYear , thisMonth ) ; int maxDay = iChronology . getDaysInYearMonth ( yearToUse , monthToUse ) ; if ( dayToUse > maxDay ) { dayToUse = maxDay ; } long datePart = iChronology . getYearMonthDayMillis ( yearToUse , monthToUse , dayToUse ) ; return datePart + timePart ; }
target:  Add the specified month to the specified time instant. The amount added may be negative.<p> If the new month has less total days than the specified day of the month, this value is coerced to the nearest sane value. e.g.<p> 07-31 - (1 month) = 06-30<p> 03-31 - (1 month) = 02-28 or 02-29 depending<p>