I am using a java webapp, In Java class i use a Remote server API to get values like 48938493843894. I export these values to a .XLSX file. I want to format this number like
$48,938,493,843,894 at the java class and export to .xlsx file.
How can i do this in Java?
For formatting currency it’s better to use
NumberFormat.getCurrencyInstance()(look at http://docs.oracle.com/javase/6/docs/api/java/text/NumberFormat.html#getCurrencyInstance) and for limiting fractional part there isNumberFormat.html#setMaximumFractionDigitsmethod.