Skip to content
Advertisement

Converting Integer to String with comma for thousands

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?

Advertisement

Answer

System.out.println(NumberFormat.getNumberInstance(Locale.US).format(35634646));
Output: 35,634,646
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement