Java Double Number Divide divide(Object dividend, Object divisor)

Here you can find the source of divide(Object dividend, Object divisor)

Description

divide

License

Open Source License

Declaration

public static BigDecimal divide(Object dividend, Object divisor) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {
    public static final int SCALE = 2;
    public static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;

    public static BigDecimal divide(Object dividend, Object divisor) {
        return new BigDecimal(dividend.toString()).divide(new BigDecimal(divisor.toString()), SCALE, ROUNDING_MODE); //dividend.divide(divisor, SCALE, ROUNDING_MODE);
    }//from w ww  .  j  av  a2 s .  c o m
}

Related

  1. divide(double x, double y, int scale, RoundingMode roundingMode)
  2. divide(final double n1, final double n2)
  3. divide(float a, float b)
  4. divide(float left, float right)
  5. divide(Number numerator, Number denominator)
  6. divide(Object num1, Object num2)
  7. divide(String num1, String num2)
  8. divide(String num1, String num2, int scale)
  9. divide(String num1, String num2, int scale)