+ 3
Double is a floating point type, so it should look like that: 123,456.123. You can use the DecimalFormat class, or simply: Double n = 123456.123; String formated = String.format("%,.3f", n); System.out.println(formated); If you meant integer/long value and without the existing formatting methods, here is one solution: https://code.sololearn.com/c515aDvAvrne/?ref=app Otherwise, simply: int n = 123456789; String formated = String.format("%,d", n); System.out.println(formated);
3rd Nov 2017, 12:46 AM
Boris Batinkov
Boris Batinkov - avatar
3rd Nov 2017, 10:43 AM
Witty Phantom
Witty Phantom - avatar