Java BigDecimal Divide divide(BigDecimal bd1, BigDecimal bd2)

Here you can find the source of divide(BigDecimal bd1, BigDecimal bd2)

Description

divide

License

Open Source License

Declaration

public static BigDecimal divide(BigDecimal bd1, BigDecimal bd2) 

Method Source Code

//package com.java2s;
import java.math.BigDecimal;

public class Main {
    public static BigDecimal divide(BigDecimal bd1, BigDecimal bd2) {
        if (bd1.compareTo(new BigDecimal(0)) == 0)
            return (new BigDecimal(0));

        if (bd2.compareTo(new BigDecimal(0)) == 0)
            return (null);

        BigDecimal result = bd1.divide(bd2, 2, BigDecimal.ROUND_HALF_UP);
        return (result);
    }/*w w w.  ja va 2s .co  m*/
}

Related

  1. div(BigDecimal v1, BigDecimal v2)
  2. div(BigDecimal val, long divisor)
  3. divide(BigDecimal a, BigDecimal b)
  4. divide(BigDecimal amount, BigDecimal divisor)
  5. divide(BigDecimal aValue1, BigDecimal aValue2, int scale)
  6. divide(BigDecimal dividend, BigDecimal divisor)
  7. divide(BigDecimal dividend, BigDecimal divisor)
  8. divide(BigDecimal dividend, BigDecimal divisor, int scale)
  9. divide(BigDecimal left, BigDecimal right)