Formatting number 234156.123 with pattern #,##,###.### using the below code is getting formatted as 234,156.123 but instead it should get formatted as
2,34,156.123
Decimal places is as per pattern whereas the numbers before decimal point is not formatting as expected.
Code written is as follows
String pattern = "#,##,###.###";
double number = 234156.123;
DecimalFormat decimalFormat = new DecimalFormat(pattern);
String format = decimalFormat.format(number);
System.out.println(format);
Result:
234,156.123
Expected Result:
2,34,156.123
`. And _only_ if you need a formatted output (like in a "self made table"), then use "code formatting", because this is currently the only way to format indentations correctly. (Edit: about your new edit: looks much better :)). – Tom Jun 22 '15 at 09:28