@Override
  public int compareTo(Size other) {
    int diff = unit.getOrderOfSize() - other.unit.getOrderOfSize();
    if (diff == 0) {
      return Double.compare(value, other.value);
    }

    BigDecimal thisValue = BigDecimal.valueOf(value);
    BigDecimal otherValue = BigDecimal.valueOf(other.value);
    if (diff > 0) {
      for (int i = 0; i != Math.abs(diff); ++i) {
        thisValue = thisValue.multiply(SCALE_BASE);
      }
    } else {
      for (int i = 0; i != Math.abs(diff); ++i) {
        otherValue = otherValue.multiply(SCALE_BASE);
      }
    }
    return thisValue.compareTo(otherValue);
  }
get the value which is converted to specified unit.
@param unit size unit
@return the converted value
hbase-client/src/main/java/org/apache/hadoop/hbase/Size.java