Here you can find the source of divide(Number numerator, Number denominator)
public static Double divide(Number numerator, Number denominator)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static int scale = 10; public static Double divide(Number numerator, Number denominator) { Double rtn = null;// w ww . j a va2 s . com if (numerator != null && denominator != null) { double dNumerator = numerator.doubleValue(); double dDenominator = denominator.doubleValue(); if (dDenominator != 0) { BigDecimal bdNumerator = new BigDecimal(dNumerator); BigDecimal bdDenominator = new BigDecimal(dDenominator); rtn = bdNumerator.divide(bdDenominator, scale, RoundingMode.HALF_UP).doubleValue(); } } return rtn; } }