static int countSwaths(BitSet arg) {
        int len = arg.length();
        int i = 0;
        int result = 0;
        while (i < len) {
            boolean current = arg.get(i);
            int j;
            if (current) {
                j = arg.nextClearBit(i + 1);
            } else {
                j = arg.nextSetBit(i + 1);
            }
            if (j == -1) {
                // no such bit found in the remainder of the bitset.
                j = len;
            }
            if (j >= i + 72*72*72) {
                j = i + 72*72*72 - 1;
            }
            result = result + 1;
            i = j;
        }
        return result;
    }