Here you can find the source of formate(BigDecimal amount)
public static String formate(BigDecimal amount)
//package com.java2s; import java.math.BigDecimal; public class Main { public static String formate(BigDecimal amount) { if (amount == null) { return "0.00"; }//from w w w . j ava 2 s . c om return amount.setScale(2, BigDecimal.ROUND_HALF_UP).toString(); } }