public void findMostValuableCombination(int itemIndex, int price, int weight) {
        if (weight <= maxWeight && price > bestFoundPrice) {
            this.bestFoundPrice = price;
            this.bestFoundWeight = weight;
            bestSet = Arrays.copyOf(tempSet, tempSet.length);
        }
        int nextItemIndex = itemIndex + 1;
        if (promising(itemIndex) && nextItemIndex < availableItems.length) {
            Item nextItem = availableItems[nextItemIndex];
            tempSet[nextItemIndex] = nextItem;
            findMostValuableCombination(nextItemIndex, price + nextItem.getPrice(), weight + nextItem.getWeight());
            tempSet[nextItemIndex] = null;
            findMostValuableCombination(nextItemIndex, price, weight);
        }
    }