SUGGESTED FIX
src/share/classes/java/math>sccs sccsdiff -r1.50 -r1.51 BigDecimal.java
------- BigDecimal.java -------
137c137
< * rounding mode, br>
---
> * rounding mode, <br>
1442c1442
< * @throws ArithmeticException if <tt>mc.precision</tt> > 0 and the result
---
> * @throws ArithmeticException if <tt>mc.precision</tt> > 0 and the result
2415a2416,2480
> * Returns a string representation of this <tt>BigDecimal</tt>
> * without an exponent field. For values with a positive scale,
> * the number of digits to the right of the decimal point is used
> * to indicate scale. For values with a zero or negative scale,
> * the resulting string is generated as if the value were
> * converted to a numerically equal value with zero scale and as
> * if all the trailing zeros of the zero scale value were present
> * in the result.
> *
> * The entire string is prefixed by a minus sign character '-'
> * (<tt>'\u002D'</tt>) if the unscaled value is less than
> * zero. No sign character is prefixed if the unscaled value is
> * zero or positive.
> *
> * Note that if the result of this method is passed to the
> * {@linkplain #BigDecimal(String) string constructor}, only the
> * numerical value of this <tt>BigDecimal</tt> will necessarily be
> * recovered; the representation of the new <tt>BigDecimal</tt>
> * may have a different scale. In particular, if this
> * <tt>BigDecimal</tt> has a positive scale, the string resulting
> * from this method will have a scale of zero when processed by
> * the string constructor.
> *
> * (This method behaves analogously to the <tt>toString</tt>
> * method in 1.4 and earlier releases.)
> *
> * @return a string representation of this <tt>BigDecimal</tt>
> * without an exponent field.
> * @since 1.5
> * @see #toString()
> * @see #toEngineeringString()
> */
> public String toPlainString() {
> BigDecimal bd = this;
> if (bd.scale < 0)
> bd = bd.setScale(0);
> if (bd.scale == 0) /* No decimal point */
> return bd.intVal.toString();
> return bd.getValueString(bd.signum(), bd.intVal.abs().toString(), bd.scale);
> }
>
> /* Returns a digit.digit string */
> private String getValueString(int signum, String intString, int scale) {
> /* Insert decimal point */
> StringBuilder buf;
> int insertionPoint = intString.length() - scale;
> if (insertionPoint == 0) { /* Point goes right before intVal */
> return (signum<0 ? "-0." : "0.") + intString;
> } else if (insertionPoint > 0) { /* Point goes inside intVal */
> buf = new StringBuilder(intString);
> buf.insert(insertionPoint, '.');
> if (signum < 0)
> buf.insert(0, '-');
> } else { /* We must insert zeros between point and intVal */
> buf = new StringBuilder(3-insertionPoint + intString.length());
> buf.append(signum<0 ? "-0." : "0.");
> for (int i=0; i<-insertionPoint; i++)
> buf.append('0');
> buf.append(intString);
> }
> return buf.toString();
> }
>
>
> /**
###@###.### 2004-02-09
|