Look at the DecimalFormat class.
And also the printf method.