Reputation: 99
I want format this number using java : 1546521.23 to 1 546 521.23 for exemple when i format this number 70000.0 it output 7 00 00
I tried this pattern but not work :
DecimalFormat decimalFormat = new DecimalFormat("### ###,##");
Upvotes: 1
Views: 56
Reputation: 18611
See the DecimalFormat documentation:
Symbol Location Localized? Meaning
. Number Yes Decimal separator or monetary decimal separator
, Number Yes Grouping separator
Change code to
DecimalFormat decimalFormat = new DecimalFormat("### ###.##");
The comma needs to be replaced with a period.
Upvotes: 1