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 getMarginVar1() {
    try {//from   w  w  w  .j av  a 2s  .c  o  m
        BigDecimal res = new BigDecimal(financialRatio.getMargin().doubleValue());
        res = res.divide(financialRatioCompOne.getMargin(), 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 getMarginVar2() {
    try {/* w  w w  .j a v a  2  s. co  m*/
        BigDecimal res = new BigDecimal(financialRatio.getMargin().doubleValue());
        res = res.divide(financialRatioCompTwo.getMargin(), 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 getCapitalVar1() {
    try {//from ww  w. java  2 s . c o  m
        BigDecimal res = new BigDecimal(financialRatio.getCapital().doubleValue());
        res = res.divide(financialRatioCompOne.getCapital(), 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 getCapitalVar2() {
    try {//from   w w w.java2 s  .c  om
        BigDecimal res = new BigDecimal(financialRatio.getCapital().doubleValue());
        res = res.divide(financialRatioCompTwo.getCapital(), 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 getIncomesVar1() {
    try {/*from   w  w w.  j a  v  a 2  s. com*/
        BigDecimal res = new BigDecimal(financialRatio.getIncomes().doubleValue());
        res = res.divide(financialRatioCompOne.getIncomes(), 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 getIncomesVar2() {
    try {//  w ww .ja  v a 2  s .co m
        BigDecimal res = new BigDecimal(financialRatio.getIncomes().doubleValue());
        res = res.divide(financialRatioCompTwo.getIncomes(), 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 getNetAssetVar1() {
    try {/*from w  w  w . j av a2s  . c o m*/
        BigDecimal res = new BigDecimal(financialRatio.getNetAsset().doubleValue());
        res = res.divide(financialRatioCompOne.getNetAsset(), 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 getNetAssetVar2() {
    try {/*from ww  w  . j  a va2 s .  com*/
        BigDecimal res = new BigDecimal(financialRatio.getNetAsset().doubleValue());
        res = res.divide(financialRatioCompTwo.getNetAsset(), 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 getReservesVar1() {
    try {//from w  w w. j  av  a 2  s  . co m
        BigDecimal res = new BigDecimal(financialRatio.getReserves().doubleValue());
        res = res.divide(financialRatioCompOne.getReserves(), 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 getReservesVar2() {
    try {/*from   w ww. j  ava 2s.c  om*/
        BigDecimal res = new BigDecimal(financialRatio.getReserves().doubleValue());
        res = res.divide(financialRatioCompTwo.getReserves(), 4, RoundingMode.HALF_UP);
        res = res.subtract(new BigDecimal(1));
        return res;

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