Since you only want it formatted to the hundredth decimal place, I use the getCurrencyInstance() method. Obviously this won't run because it is just a sniplet of code.
Anyways, that would print out a formatted aLongNumber with decimals up to the hundredth spot. If you wanted to set that value in a variable, you'd just create another double variable and set the fmt.format(aLongNumber) to it.Code:import java.text.NumberFormat; ...... (Assume proper code is in here) double aLongNumber = 658.156168; NumberFormat fmt = NumberFormat.getCurrencyInstance(); System.out.println(fmt.format(aLongNumber));
- dave
[edit]
I write like a retard sometimes. =P




Reply With Quote