protected static double scale(double min, double max, double value) {
    double costEpsilon = getCostEpsilon(max);
    if (
      max <= min || value <= min || Math.abs(max - min) <= costEpsilon
        || Math.abs(value - min) <= costEpsilon
    ) {
      return 0;
    }
    if (max <= min || Math.abs(max - min) <= costEpsilon) {
      return 0;
    }

    return Math.max(0d, Math.min(1d, (value - min) / (max - min)));
  }
Scale the value between 0 and 1.
@param min   Min value
@param max   The Max value
@param value The value to be scaled.
@return The scaled value.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java