Here you can find the source of formatAmount(Double amount)
public static String formatAmount(Double amount)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { public static String formatAmount(Double amount) { return String.format("%.2f", amount); }/*from ww w. j a v a2 s .com*/ public static String formatAmount(BigDecimal amount) { return new DecimalFormat("#0.00").format(amount); } }