code: public static double overlap(Range range, Range otherRange) {
          double minOverlap = Math.max(range.getMinimum().doubleValue(), otherRange.getMinimum().doubleValue());
          double maxOverlap = Math.min(range.getMaximum().doubleValue(), otherRange.getMaximum().doubleValue());
          double overlapWidth = maxOverlap - minOverlap;
          double rangeWidth = range.getMaximum().doubleValue() - range.getMinimum().doubleValue();
          double fraction = Math.max(0.0, overlapWidth / rangeWidth);
          return fraction;
      }
docs: Percentage, from 0 to 1, of the first range that is contained by
  the second range.
  
  @param range the range to be contained by the second
  @param otherRange the range that has to contain the first
  @return from 0 (if there is no intersection) to 1 (if the ranges are the same)