Here you can find the source of round(BigDecimal decimal, int decimalDigits)
public static BigDecimal round(BigDecimal decimal, int decimalDigits)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static BigDecimal round(BigDecimal decimal, int decimalDigits) { BigDecimal scale = new BigDecimal(Math.pow(10, decimalDigits)); return new BigDecimal(Math.round(decimal.multiply(scale).doubleValue())).divide(scale); }/* ww w . j ava2 s. c o m*/ }