public String toFormalString() {
    if (this.signum == 0) {
      return "0";
    }

    StringBuilder buf = new StringBuilder(50);
    if (this.signum < 0) {
      buf.append('-');
    }

    String unscaled = this.unscaledValue.toFormalString();
    if (unscaled.length() > this.scale) {

      // write out integer part first
      // then write out fractional part
      buf.append(unscaled, 0, unscaled.length() - this.scale);

      if (this.scale > 0) {
        buf.append('.');
        buf.append(unscaled, unscaled.length() - this.scale, unscaled.length());
      }
    } else {

      // no integer part
      buf.append('0');

      if (this.scale > 0) {

        // fractional part has, starting with zeros
        buf.append('.');
        for (int i = unscaled.length(); i < this.scale; ++i) {
          buf.append('0');
        }
        buf.append(unscaled);
      }
    }

    return new String(buf);
  }
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/Decimal128.java