You should put more thought in your example.
Try to use some value of
double amount
that doesn't match your formatter already; that is, has more/less digits after decimal point than in your pattern.
Otherwise,
System.out.println("The Decimal Value is:" + amount);
will give you exactly the same output as your
System.out.println("The Decimal Value is:"+formatter.format(amount));
Your example says nothing about rounding numbers.
AwesomeEli June 7, 2011 at 10:40 PM
Thanks for the post - it worked perfectly!
code example is not good Alex March 15, 2013 at 9:15 PM
You should put more thought in your example. Try to use some value of double amount that doesn't match your formatter already; that is, has more/less digits after decimal point than in your pattern. Otherwise, System.out.println("The Decimal Value is:" + amount); will give you exactly the same output as your System.out.println("The Decimal Value is:"+formatter.format(amount)); Your example says nothing about rounding numbers.
Post your Comment