Here you can find the source of subtract(BigDecimal num1, BigDecimal num2)
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { public static final int STANDARD_ROUND_HALF = BigDecimal.ROUND_HALF_UP; public static final int STANDARD_SCALE = 2; /**/*from www. ja va 2 s . co m*/ * 0 **/ public static final BigDecimal ZERO = new BigDecimal("0"); public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) { if (null == num1 || null == num2) { return ZERO; } BigDecimal temp = num1.subtract(num2); return temp.setScale(STANDARD_SCALE, STANDARD_ROUND_HALF); } }