public static int fastTrailingDecimalZeroCount(
      long fast0, long fast1, long fast2,
      int fastIntegerDigitCount, int fastScale) {
    if (fastScale < 0 || fastScale > HiveDecimal.MAX_SCALE) {
      throw new IllegalArgumentException("Expecting scale >= 0 and scale <= 38");
    }
    if (fastScale == 0) {
      return 0;
    }

    final int lowerLongwordDigits = Math.min(fastScale, LONGWORD_DECIMAL_DIGITS);
    if (lowerLongwordDigits < LONGWORD_DECIMAL_DIGITS || fast0 != 0) {
      long factor = 10;
      for (int i = 0; i < lowerLongwordDigits; i++) {
        if (fast0 % factor != 0) {
          return i;
        }
        factor *= 10;
      }
      if (lowerLongwordDigits < LONGWORD_DECIMAL_DIGITS) {
        return fastScale;
      }
    }
    if (fastScale == LONGWORD_DECIMAL_DIGITS) {
      return fastScale;
    }
    final int middleLongwordDigits = Math.min(fastScale - LONGWORD_DECIMAL_DIGITS, LONGWORD_DECIMAL_DIGITS);
    if (middleLongwordDigits < LONGWORD_DECIMAL_DIGITS || fast1 != 0) {
      long factor = 10;
      for (int i = 0; i < middleLongwordDigits; i++) {
        if (fast1 % factor != 0) {
          return LONGWORD_DECIMAL_DIGITS + i;
        }
        factor *= 10;
      }
      if (middleLongwordDigits < LONGWORD_DECIMAL_DIGITS) {
        return fastScale;
      }
    }
    if (fastScale == TWO_X_LONGWORD_DECIMAL_DIGITS) {
      return fastScale;
    }
    final int highLongwordDigits = fastScale - TWO_X_LONGWORD_DECIMAL_DIGITS;
    if (highLongwordDigits < HIGHWORD_DECIMAL_DIGITS || fast2 != 0) {
      long factor = 10;
      for (int i = 0; i < highLongwordDigits; i++) {
        if (fast2 % factor != 0) {
          return TWO_X_LONGWORD_DECIMAL_DIGITS + i;
        }
        factor *= 10;
      }
    }
    return fastScale;
  }
Fast decimal scale up by factor of 10.
@param fast0 word 0 of the internal representation
@param fast1 word 1
@param fast2 word 2
@param scaleUp the number of integer digits to scale up by
@param fastResult an object to reuse
@return was the operation successfule?
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java