private static boolean scaleUpTenArray(int[] array, short tenScale) {
    while (tenScale > 0) {
      long sum = 0L;
      int powerTen = Math.min(tenScale, SqlMathUtil.MAX_POWER_TEN_INT31);
      tenScale -= powerTen;

      final long rightUnsigned = SqlMathUtil.POWER_TENS_INT31[powerTen]
          & SqlMathUtil.LONG_MASK;
      for (int i = 0; i < INT_COUNT; ++i) {
        sum = (array[i] & SqlMathUtil.LONG_MASK) * rightUnsigned + (sum >>> 32);
        array[i] = (int) sum;
      }

      if ((sum >> 32) != 0) {

        // overflow means this is smaller
        return true;
      }
    }
    return false;
  }
@param array
@param tenScale
@return Whether it overflowed
common/src/java/org/apache/hadoop/hive/common/type/UnsignedInt128.java