private BigDecimal[] relativeCloses( Quotations stockQuotations, MInteger startDateQuotationIndex, MInteger endDateQuotationIndex, BigDecimal unitCost) { ArrayList<BigDecimal> retA = new ArrayList<BigDecimal>(); for (int i = startDateQuotationIndex.value; i <= endDateQuotationIndex.value; i++) { BigDecimal value = BigDecimal.ZERO; if (unitCost.compareTo(BigDecimal.ZERO) != 0) { BigDecimal close = stockQuotations.get(i).getClose(); value = (close.subtract(unitCost).divide(unitCost.abs(), 10, BigDecimal.ROUND_HALF_EVEN)); } retA.add(value); } return retA.toArray(new BigDecimal[0]); }