code: public Interval intersection(Interval other) {
          Objects.requireNonNull(other, "other");
          if (isConnected(other) == false) {
              throw new DateTimeException("Intervals do not connect: " + this + " and " + other);
          }
          int cmpStart = start.compareTo(other.start);
          int cmpEnd = end.compareTo(other.end);
          if (cmpStart >= 0 && cmpEnd <= 0) {
              return this;
          } else if (cmpStart <= 0 && cmpEnd >= 0) {
              return other;
          } else {
              Instant newStart = (cmpStart >= 0 ? start : other.start);
              Instant newEnd = (cmpEnd <= 0 ? end : other.end);
              return Interval.of(newStart, newEnd);
          }
      }
docs: Calculates the interval that is the intersection of this interval and the specified interval.
  <p>
  This finds the intersection of two intervals.
  This throws an exception if the two intervals are not {@linkplain #isConnected(Interval) connected}.
  
  @param other  the other interval to check for, not null
  @return the interval that is the intersection of the two intervals
  @throws DateTimeException if the intervals do not connect