Here you can find the source of formatMoney(BigDecimal bd)
public static String formatMoney(BigDecimal bd)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.RoundingMode; import java.text.NumberFormat; import java.util.*; public class Main { public static String formatMoney(BigDecimal bd) { NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US); nf.setRoundingMode(RoundingMode.HALF_EVEN); return nf.format(bd.setScale(2, RoundingMode.HALF_EVEN)); }/*from w w w . j a v a2 s. c om*/ }