public static int fastIntValueClip(
      int fastSignum, long fast0, long fast1, long fast2,
      int fastIntegerDigitCount, int fastScale) {

    if (fastScale == 0) {
      if (fast1 == 0 && fast2 == 0) {
        if (fastSignum == 1) {
          if (fast0 <= Integer.MAX_VALUE) {
            return (int) fast0;
          }
        } else {
          if (-fast0 >= Integer.MIN_VALUE) {
            return (int) -fast0;
          };
        }
      }
      // SLOW: Do remainder with BigInteger.
      BigInteger bigInteger =
          fastBigIntegerValueUnscaled(
              fastSignum, fast0, fast1, fast2);
      return bigInteger.remainder(BIG_INTEGER_UNSIGNED_INT_MAX_VALUE).intValue();
    } else {

      // Adjust all longs using power 10 division/remainder.
      long result0;
      long result1;
      long result2;
      if (fastScale < LONGWORD_DECIMAL_DIGITS) {

        // Part of lowest word survives.

        final long divideFactor = powerOfTenTable[fastScale];
        final long multiplyFactor = powerOfTenTable[LONGWORD_DECIMAL_DIGITS - fastScale];

        result0 =
            fast0 / divideFactor
          + ((fast1 % divideFactor) * multiplyFactor);
        result1 =
            fast1 / divideFactor
          + ((fast2 % divideFactor) * multiplyFactor);
        result2 =
            fast2 / divideFactor;

      } else if (fastScale < TWO_X_LONGWORD_DECIMAL_DIGITS) {

        // Throw away lowest word.

        final int adjustedScaleDown = fastScale - LONGWORD_DECIMAL_DIGITS;

        final long divideFactor = powerOfTenTable[adjustedScaleDown];
        final long multiplyFactor = powerOfTenTable[LONGWORD_DECIMAL_DIGITS - adjustedScaleDown];

        result0 =
            fast1 / divideFactor
          + ((fast2 % divideFactor) * multiplyFactor);
        result1 =
            fast2 / divideFactor;
        result2 = 0;

      } else {

        // Throw away middle and lowest words.

        final int adjustedScaleDown = fastScale - 2*LONGWORD_DECIMAL_DIGITS;

        result0 =
            fast2 / powerOfTenTable[adjustedScaleDown];
        result1 = 0;
        result2 = 0;

      }

      if (result1 == 0 && result2 == 0) {
        if (fastSignum == 1) {
          if (result0 <= Integer.MAX_VALUE) {
            return (int) result0;
          }
        } else {
          if (-result0 >= Integer.MIN_VALUE) {
            return (int) -result0;
          };
        }
      }
      // SLOW: Do remainder with BigInteger.
      BigInteger bigInteger =
          fastBigIntegerValueUnscaled(
              fastSignum, result0, result1, result2);
      return bigInteger.remainder(BIG_INTEGER_UNSIGNED_INT_MAX_VALUE).intValue();
    }
  }
Is the decimal value a int? Range -2,147,483,648     to   2,147,483,647.
                                  Integer.MIN_VALUE       Integer.MAX_VALUE

Emulates testing for no value corruption:
     bigDecimalValue().setScale(0).equals(BigDecimal.valueOf(bigDecimalValue().intValue()))

NOTE: Fractional digits are ignored in the test since fastIntValueClip() will
      remove them (round down).

@param fastSignum the sign (-1, 0, or +1)
@param fast0 word 0 of the internal representation
@param fast1 word 1
@param fast2 word 2
@param fastIntegerDigitCount the number of integer digits
@param fastScale the scale of the number
@return True when fastIntValueClip() will return a correct int.
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java