Here you can find the source of calculateRoundDoubleQuotientOfTowIntegerNumber(Integer dividend, Integer divisor)
Parameter | Description |
---|---|
dividend | a parameter |
divisor | a parameter |
public static Double calculateRoundDoubleQuotientOfTowIntegerNumber(Integer dividend, Integer divisor)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static Double calculateRoundDoubleQuotientOfTowIntegerNumber(Integer dividend, Integer divisor) { return round(calculateDoubleQuotientOfTowIntegerNumber(dividend, divisor)); }//from w w w .j a va 2s . c om public static Double round(Double decimal) { return round(decimal, 2); } public static Double round(Double decimal, Integer scale) { BigDecimal bigDecimal = new BigDecimal(decimal); Double roundDecimal = bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue(); return roundDecimal; } public static Double calculateDoubleQuotientOfTowIntegerNumber(Integer dividend, Integer divisor) { Double doubleDividend = (double) dividend; Double doubleDivisor = (double) divisor; Double quotient = doubleDividend / doubleDivisor; return quotient; } }