Here you can find the source of roundBigDecimal(BigDecimal num)
public static BigDecimal roundBigDecimal(BigDecimal num)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static BigDecimal roundBigDecimal(BigDecimal num) { return roundBigDecimal(num, 2); }/*from w w w .ja v a 2s . c o m*/ public static BigDecimal roundBigDecimal(BigDecimal num, int scale) { if (num != null) { return num.setScale(scale, RoundingMode.HALF_UP); } return num; } }