private void deleteUnattainableStates() {
        boolean attainable[] = new boolean[states.length];
        for (int i = 0; i < states.length; i++) {
            attainable[i] = false;
        }

        State state;
        Queue<State> queue = new LinkedList<State>();

        queue.clear();
        queue.add(state0);
        attainable[state0.getNumber()] = true;
        while (!queue.isEmpty()) {
            state = queue.poll();
            if (state == null) {
                break;
            }
            for (Character ch : alphavet) {
                State st = state.getNextState(ch);
                if (st != null && !attainable[st.getNumber()]) {
                    attainable[st.getNumber()] = true;
                    queue.add(st);
                }
            }
        }

        for (int i = 0; i < states.length; i++) {
            if (!attainable[i]) {
                states[i] = null;
            }
        }
    }