class NumberUtils {

    public static DivisionResult divideWithLoss(Double dividend,
            Integer divisor, boolean resultToBeNegative) {
        DivisionResult result = new DivisionResult();
        Double dividendHere = Math.abs(dividend);
        Double divisionResult = NumberUtils.divide(dividendHere,
                Integer.valueOf(divisor));
        Double loss = NumberUtils.round(dividendHere
                - NumberUtils.multiply(divisionResult, divisor));
        if (resultToBeNegative) {
            divisionResult = NumberUtils.neg(divisionResult);
            loss = NumberUtils.neg(loss);
        }
        result.setLoss(loss);
        result.setResult(divisionResult);
        return result;
    }

}