0

In my code finally amount will be generated. I want to display it in indian rupees format like 10 100 1,000 10,000 1,00,000 10,00,000 1,00,00,000 10,00,00,000 etc. How can i insert commas ? eg: int amount=1000;

Vijay Kumar
  • 63
  • 3
  • 7
  • 11

2 Answers2

3

You can do this by using locale like

Here you can use any locale for your case it should be en_IN

NumberFormat.getCurrencyInstance(locale).format(paramDouble);
Ashok
  • 1,251
  • 11
  • 19
-1

You could use the java.text.DecimalFormat

and do something like this:

DecimalFormat df = new DecimalFormat(###,##0);
DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
dfs.setDecimalSeparator('.');
dfs.setGroupingSeparator(',');
df.setDecimalFormatSymbols(dfs);
df.format(numberToFormat);
Frederic Close
  • 9,389
  • 6
  • 56
  • 67