UpdatableIntToIntMap (@NotNull final Predicate<? super Integer> thisIsVisible, final int longSize) { if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize); if (longSize == 0) return IDIntToIntMap.EMPTY; int countLevels; // longSize -> countLevels: 1..2 -> 2; 3..4 -> 3; 5..8 -> 4 if (longSize == 1) { countLevels = 2; } else { countLevels = countDigits(longSize - 1) + 1; } int[] emptyTree = new int[(1 << (countLevels - 1))]; TreeIntToIntMap intToIntMap = new TreeIntToIntMap(thisIsVisible, longSize, countLevels, emptyTree); intToIntMap.update(0, longSize - 1); return intToIntMap; }