Displaying numbers in Comma format Using Java

by guruprasad 2013-12-30 17:28:08

To Display the numbers in comma format:


String numWithoutComma = "123456789.254";
double numWithComma = Double.parseDouble(numWithoutComma);
DecimalFormat formatter = new DecimalFormat("#,## #.00");

System.out.println(formatter.format(numWithComma));


Output:
123,456,789.254
621
like
0
dislike
0
mail
flag

You must LOGIN to add comments