Here you can find the source of formatDecimal(BigDecimal b)
public static String formatDecimal(BigDecimal b)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; public class Main { public static String formatDecimal(BigDecimal b) { if (b == null) { return null; }/*from w ww .ja va 2 s . c om*/ Locale loc = new Locale("nl", "NL", "EURO"); NumberFormat n = NumberFormat.getCurrencyInstance(loc); double doublePayment = b.doubleValue(); String s = n.format(doublePayment); return s; } public static String formatDecimal(BigInteger b) { Locale loc = new Locale("nl", "NL", "EURO"); NumberFormat n = NumberFormat.getCurrencyInstance(loc); double doublePayment = b.doubleValue(); n.setMaximumFractionDigits(0); String s = n.format(doublePayment); return s; } public static String format(int amount) { DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN); otherSymbols.setDecimalSeparator(','); otherSymbols.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat("###,###,###,##0", otherSymbols); return df.format(amount); } public static String format(BigInteger amount) { if (amount == null) { return null; } DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN); otherSymbols.setDecimalSeparator(','); otherSymbols.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat("###,###,###,##0", otherSymbols); return df.format(amount); } }