java code to convert a regular expression to nfa