Here you can find the source of limitScale(BigDecimal value, int scale)
static private BigDecimal limitScale(BigDecimal value, int scale)
//package com.java2s; import java.math.*; public class Main { static private BigDecimal limitScale(BigDecimal value, int scale) { if (value.scale() > scale) { value = value.setScale(scale, RoundingMode.HALF_UP); }/*from ww w.j av a2 s .com*/ return value; } }