Example usage for java.math BigDecimal divide

List of usage examples for java.math BigDecimal divide

Introduction

In this page you can find the example usage for java.math BigDecimal divide.

Prototype

public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode) 

Source Link

Document

Returns a BigDecimal whose value is (this / divisor) , and whose scale is as specified.

Usage

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBdtVar1() {
    try {//from   w w w.  j  av a 2  s.  c o  m
        BigDecimal res = new BigDecimal(financialRatio.getBdt().doubleValue());
        res = res.divide(financialRatioCompOne.getBdt(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBdtVar2() {
    try {/*from  w  w w.j  a  va 2  s.c om*/
        BigDecimal res = new BigDecimal(financialRatio.getBdt().doubleValue());
        res = res.divide(financialRatioCompTwo.getBdt(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBaitVar1() {
    try {/* www.  ja v a 2  s.  c o m*/
        BigDecimal res = new BigDecimal(financialRatio.getBait().doubleValue());
        res = res.divide(financialRatioCompOne.getBait(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBaitVar2() {
    try {/*from w w  w  . j  a v a  2 s  .c  o  m*/
        BigDecimal res = new BigDecimal(financialRatio.getBait().doubleValue());
        res = res.divide(financialRatioCompTwo.getBait(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getTaxesVar1() {
    try {/*ww  w  .  jav a2 s  .  co m*/
        BigDecimal res = new BigDecimal(financialRatio.getTaxes().doubleValue());
        res = res.divide(financialRatioCompOne.getTaxes(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getTaxesVar2() {
    try {//from   w  w  w  .  j  ava2s  .c o m
        BigDecimal res = new BigDecimal(financialRatio.getTaxes().doubleValue());
        res = res.divide(financialRatioCompTwo.getTaxes(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBaitdVar1() {
    try {//  www. ja v a 2 s. c o m
        BigDecimal res = new BigDecimal(financialRatio.getBaitd().doubleValue());
        res = res.divide(financialRatioCompOne.getBaitd(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getBaitdVar2() {
    try {/* ww  w  .j a  va  2s.c  o m*/
        BigDecimal res = new BigDecimal(financialRatio.getBaitd().doubleValue());
        res = res.divide(financialRatioCompTwo.getBaitd(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getStocksVar1() {
    try {// ww  w  .j a  v a  2s. co  m
        BigDecimal res = new BigDecimal(financialRatio.getStocks().doubleValue());
        res = res.divide(financialRatioCompOne.getStocks(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}

From source file:com.autentia.intra.bean.billing.FinancialRatioBean.java

public BigDecimal getStocksVar2() {
    try {//from   w  ww. ja  va  2 s.c  o  m
        BigDecimal res = new BigDecimal(financialRatio.getStocks().doubleValue());
        res = res.divide(financialRatioCompTwo.getStocks(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

    } catch (Exception e) {
        return new BigDecimal(0);
    }
}