Java examples for java.math:BigDecimal Format
insert Commas to BigDecimal format
//package com.java2s; import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { public static String insertCommas(BigDecimal number) { // for your case use this pattern -> #,##0.00 DecimalFormat df = new DecimalFormat("#,##0.00"); return df.format(number); }//from ww w . j a va 2 s. c o m public static String insertCommas(String number) { return insertCommas(new BigDecimal(number)); } }