public String toFormalString() {
    char[] buf = new char[MAX_DIGITS + 1];
    int bufCount = 0;
    int nonZeroBufCount = 0;

    final int tenScale = SqlMathUtil.MAX_POWER_TEN_INT31;
    final int tenPower = SqlMathUtil.POWER_TENS_INT31[tenScale];
    UnsignedInt128 tmp = new UnsignedInt128(this);

    while (!tmp.isZero()) {
      int remainder = tmp.divideDestructive(tenPower);
      for (int i = 0; i < tenScale && bufCount < buf.length; ++i) {
        int digit = remainder % 10;
        remainder /= 10;
        buf[bufCount] = (char) (digit + '0');
        ++bufCount;
        if (digit != 0) {
          nonZeroBufCount = bufCount;
        }
      }
    }

    if (bufCount == 0) {
      return "0";
    } else {
      char[] reversed = new char[nonZeroBufCount];
      for (int i = 0; i < nonZeroBufCount; ++i) {
        reversed[i] = buf[nonZeroBufCount - i - 1];
      }
      return new String(reversed);
    }
  }
Returns the formal string representation of this value. Unlike the debug
string returned by {@link #toString()}, this method returns a string that
can be used to re-construct this object. Remember, toString() is only for
debugging.

@return string representation of this value
common/src/java/org/apache/hadoop/hive/common/type/UnsignedInt128.java