BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) constructor from BigDecimal has the following syntax.
public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc)
In the following code shows how to use BigDecimal.BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) constructor.
import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; //from w ww . j ava 2 s . c o m public class Main { public static void main(String[] args) { MathContext mc = new MathContext(3); BigDecimal bg1 = new BigDecimal(new BigInteger("40"),2,mc); } }