private int calcMaxSize(int capacity) {
        // Clip the upper bound so that there will always be at least one available slot.
        int upperBound = capacity - 1;
        return Math.min(upperBound, (int) (capacity * loadFactor));
    }
Calculates the maximum size allowed before rehashing.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/ByteObjectHashMap.java