public boolean pad(int factor) throws IOException {
        int padding = factor - (int) (this.nrBits % factor);
        boolean result = true;

        for (int i = 0; i < padding; i += 1) {
            if (bit()) {
                result = false;
            }
        }
        return result;
    }