Here you can find the source of round(BigDecimal value, int places)
public static BigDecimal round(BigDecimal value, int places)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static double round(double value, int places) { if (places < 0) throw new IllegalArgumentException(); BigDecimal bd = new BigDecimal(value); bd = bd.setScale(places, RoundingMode.HALF_UP); return bd.doubleValue(); }/*w w w .j ava2 s . c o m*/ public static BigDecimal round(BigDecimal value, int places) { if (places < 0) throw new IllegalArgumentException(); value = value.setScale(places, RoundingMode.HALF_UP); return value; } }