Here you can find the source of formatDollarTd(Object obj)
public static String formatDollarTd(Object obj)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.math.BigDecimal; public class Main { public static String formatDollarTd(Object obj) { String out = "<td style='text-align:right'>"; String strDollarAmt = formatDollar(obj); if (strDollarAmt.length() == 0) { // if you don't put a "non-breaking space" in an empty td/cell, // the cell's border doesn't show ! out += " "; } else {//from ww w.j av a2s . c om out += strDollarAmt; } out += "</td>"; return out; } public static String formatDollar(Object obj) { // null gets converted to empty string if (obj == null) { return ""; } BigDecimal bd = (BigDecimal) obj; try { DecimalFormat intFormat = new DecimalFormat("$###,###,###,##0.00"); return intFormat.format(bd); } catch (Exception e) { return "bad Dollar Amount in FormatUtils:" + obj.toString() + " Error:" + e.getMessage(); } } }