Here you can find the source of round(BigDecimal number)
public static BigDecimal round(BigDecimal number)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; public class Main { /**/*from w w w.j av a 2s . com*/ * Round to two decimal places */ public static BigDecimal round(BigDecimal number) { return number.setScale(2, RoundingMode.HALF_UP); } public static String round(double weight) { DecimalFormat format = new DecimalFormat("#.#"); format.setRoundingMode(RoundingMode.HALF_UP); return format.format(weight); } }