code: private static Double calculateMean(Number min, Number max) {
      if (min == null || max == null) {
        return null;
      }
      return (min.doubleValue() + max.doubleValue()) / 2;
    }
docs: Returns the mean of the two Number values if neither is null, else returns null.