private static Set<List<Boolean>> buildRollUpPermutations(final int tagCount) {
        if (tagCount < 0 || tagCount > MASK_LENGTH) {
            throw new IllegalArgumentException(String.format(
                    "buildRollUpPermutations called for too high a tagCount [%s], valid values are 0 to %s", tagCount,
                    MASK_LENGTH));
        }

        final Set<List<Boolean>> resultSet = new HashSet<>();

        if (tagCount == 0) {
            resultSet.add(Arrays.asList(Boolean.FALSE));
        } else {
            permute(new ArrayList<>(), tagCount, resultSet);
        }

        return resultSet;
    }
Cache the perms in two static maps for a given number of tags

@param tagCount
@return
stroom-statistics/stroom-statistics-impl-sql/src/main/java/stroom/statistics/impl/sql/rollup/RollUpBitMask.java