Here you can find the source of formatAmount(double amount)
public static String formatAmount(double amount)
//package com.java2s; import java.math.BigDecimal; import java.text.NumberFormat; public class Main { public static String formatAmount(double amount) { NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(0);/*from www .j a v a2 s .com*/ nf.setGroupingUsed(false); return nf.format(amount); } public static String formatAmount(BigDecimal amount) { NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(0); nf.setGroupingUsed(false); return nf.format(amount); } }