private Inventory solveExhaustivelyRecursively(int indexOfNextItem, int remainingCapacity, ArrayList<Double> result, int value) {
        if (indexOfNextItem >= items.size()) {
            return new Inventory(this, result, value);
        }

        Item nextItem = items.get(indexOfNextItem);

        result.add(0.0);
        Inventory resultWhenExcluded = solveExhaustivelyRecursively(indexOfNextItem + 1, remainingCapacity, result, value);

        result.set(result.size() - 1, 1.0);
        Inventory resultWhenIncluded = solveExhaustivelyRecursively(indexOfNextItem + 1, remainingCapacity, result, value + nextItem.getValue());
        result.remove(result.size() - 1);
        if (resultWhenIncluded.getTotalValue() >= resultWhenExcluded.getTotalValue() && resultWhenIncluded.getTotalWeight() <= remainingCapacity) {
            return resultWhenIncluded;
        } else {
            return resultWhenExcluded;
        }
    }