Converting Integer to String with comma for thousands

Dominik picture Dominik · Aug 15, 2011 · Viewed 153.9k times · Source

I want to convert an Integer 35634646 to have the thousand "," so it should be 35,634,646.

What would be the quickest way to doing that?

Answer

Eng.Fouad picture Eng.Fouad · Aug 15, 2011
System.out.println(NumberFormat.getNumberInstance(Locale.US).format(35634646));
Output: 35,634,646