Here you can find the source of subtract(BigDecimal a, BigDecimal b)
public static BigDecimal subtract(BigDecimal a, BigDecimal b)
//package com.java2s; import java.math.BigDecimal; import java.math.RoundingMode; public class Main { private static int scale = 5; public static BigDecimal subtract(BigDecimal a, BigDecimal b) { return a.subtract(b).setScale(scale, RoundingMode.HALF_UP); }/*from w ww .j a v a 2 s . c o m*/ }