Code example for BigDecimal

Methods: subtract

0
	public static BigDecimal dividirSixCasas(BigDecimal bd1, BigDecimal bd2) {
		return bd1.divide(bd2, 6, DEFAULT_ROUND_MODE).setScale(6);
	} 
 
	public static BigDecimal subtrair(BigDecimal bd1, BigDecimal bd2) {
		return bd1.subtract(bd2, getMathContext());
	} 
 
	public static BigDecimal somar(BigDecimal bd1, BigDecimal bd2) {
		return bd1.add(bd2, getMathContext());
	} 
 
	public static MathContext getMathContext() {
		return new MathContext(20, DEFAULT_ROUND_MODE);
	} 
 
	public static BigDecimal arredondarDuasCasas(BigDecimal bd) {
		return bd.setScale(2, DEFAULT_ROUND_MODE);
	} 
 
	public static BigDecimal arredondarTresCasas(BigDecimal bd) {