Take a look at the JavaDoc for the
DecimalFormat class. It is a class used to format Decimal numbers like you are trying to do. The DecimalFormat class is a subclass of the
NumberFormat.
You can then look at
Java Tutorial on
Formatting Numeric Output. That lesson first talks about the System class' printf() and format() methods, and then the DecimalFormat class.
You can also find
examples of using the DecimalFormat class on exampledepot.com
[ May 15, 2008: Message edited by: Mark Vedder ]