Here you can find the source of format2Scale(BigDecimal obj)
public static String format2Scale(BigDecimal obj)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP; public static String format2Scale(BigDecimal obj) { if (obj != null) { return obj.setScale(2, ROUNDING_MODE).toPlainString(); } else {//from w w w . j av a 2s . c om return ""; } } }