Here you can find the source of sub(BigDecimal v1, BigDecimal v2)
public static BigDecimal sub(BigDecimal v1, BigDecimal v2)
//package com.java2s; //License from project: LGPL import java.math.BigDecimal; public class Main { public static BigDecimal sub(BigDecimal v1, BigDecimal v2) { BigDecimal b1 = new BigDecimal("0"); if (v1 != null) { b1 = new BigDecimal(Double.toString(v1.doubleValue())); }// w w w. ja va 2 s . c o m BigDecimal b2 = new BigDecimal("0"); if (v2 != null) { b2 = new BigDecimal(Double.toString(v2.doubleValue())); } return b1.subtract(b2); } }