code: public final Dur add(final Dur duration) {
          if ((!isNegative() && duration.isNegative())
                  || (isNegative() && !duration.isNegative())) {
  
              throw new IllegalArgumentException(
                      "Cannot add a negative and a positive duration");
          }
  
          Dur sum;
          if (weeks > 0 && duration.weeks > 0) {
              sum = new Dur(weeks + duration.weeks);
          }
          else {
              int daySum = (weeks > 0) ? weeks * DAYS_PER_WEEK + days : days;
              int hourSum = hours;
              int minuteSum = minutes;
              int secondSum = seconds;
  
              if ((secondSum + duration.seconds) / SECONDS_PER_MINUTE > 0) {
                  minuteSum += (secondSum + duration.seconds) / SECONDS_PER_MINUTE;
                  secondSum = (secondSum + duration.seconds) % SECONDS_PER_MINUTE;
              }
              else {
                  secondSum += duration.seconds;
              }
  
              if ((minuteSum + duration.minutes) / MINUTES_PER_HOUR > 0) {
                  hourSum += (minuteSum + duration.minutes) / MINUTES_PER_HOUR;
                  minuteSum = (minuteSum + duration.minutes) % MINUTES_PER_HOUR;
              }
              else {
                  minuteSum += duration.minutes;
              }
  
              if ((hourSum + duration.hours) / HOURS_PER_DAY > 0) {
                  daySum += (hourSum + duration.hours) / HOURS_PER_DAY;
                  hourSum = (hourSum + duration.hours) % HOURS_PER_DAY;
              }
              else {
                  hourSum += duration.hours;
              }
  
              daySum += (duration.weeks > 0) ? duration.weeks * DAYS_PER_WEEK
                      + duration.days : duration.days;
  
              sum = new Dur(daySum, hourSum, minuteSum, secondSum);
          }
          sum.negative = negative;
          return sum;
      }
docs: Add two durations. Durations may only be added if they are both positive
  or both negative durations.
  @param duration the duration to add to this duration
  @return a new instance representing the sum of the two durations.