I'm studying for SCJP, and my book (Sierra's) says about the Formatter class that I can use the flag "," to use locale-specific grouping separator. If I understand well, this line of code:
System.out.printf("%2$,f + %1$,f", 123.7, 456.2);
should produce:
456,200000 + 123,700000
with comma, but it's actually producing:
456.200000 + 123.700000
What I'm doing wrong?
System.out.printf("%2$,f + %1$,f", 1232.7, 4562343.2);
will give you
4,562,343.200000 + 1,232.700000
The numbers you are using for your example are less than 1000 and do not need thousand separators.