public void update(char[] str, int offset, int length) {

    // Skip leading zeros and compute number of digits in magnitude
    final int end = offset + length;
    assert (end <= str.length);
    int cursor = offset;
    while (cursor < end && str[cursor] == '0') {
      ++cursor;
    }

    if (cursor == end) {
      zeroClear();
      return;
    }
    if (end - cursor > MAX_DIGITS) {
      SqlMathUtil.throwOverflowException();
    }

    int accumulated = 0;
    int accumulatedCount = 0;
    while (cursor < end) {
      if (str[cursor] < '0' || str[cursor] > '9') {
        throw new NumberFormatException("Invalid string:"
            + new String(str, offset, length));
      }

      if (accumulatedCount == 9) {
        scaleUpTenDestructive((short) accumulatedCount);
        addDestructive(accumulated);
        accumulated = 0;
        accumulatedCount = 0;
      }
      int digit = str[cursor] - '0';
      accumulated = accumulated * 10 + digit;
      ++accumulatedCount;
      ++cursor;
    }

    if (accumulatedCount > 0) {
      scaleUpTenDestructive((short) accumulatedCount);
      addDestructive(accumulated);
    }
  }
Updates the value of this object from the given string with given offset
and length.

@param str
         string
@param offset
         offset
@param length
         length
common/src/java/org/apache/hadoop/hive/common/type/UnsignedInt128.java