See the Formatter class for useful method to format a numeric value as you want to see it.