i believe this is the "setScale() method" with specifying the "ROUND_UNNECESSARY" rounding mode,
the
Java API for this:
http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html
For example,
which outputs
original: 1.50000 result: 1.5
original: 10.00000 result: 10.0
but this isn't the "two significant digits" thing you have there, in that setScale() works to set the number of decimal places to be scaled to, (typically for currency quantities I would use 2 and ROUND_HALFEVEN)
I guess if you wanted to show up to 1 decimal place, but no decimal places when the number is an integer (whole number), then we could run it through a decimal formatter
which now outputs
original: 1.50000 result: 1.5
original: 10.00000 result: 10