for ( Integer key : autB.getStates() ) { stateMaxB = Math.max(stateMaxB, key); } for ( Integer key : autA.getStates() ) { stateMaxA = Math.max(stateMaxA, key); }  if (stateMaxA>=stateMaxB) { resultFSA = (FSA)autA.clone(); otherClone = (FSA)autB.clone(); offset = stateMaxA; } else { resultFSA = (FSA)autB.clone(); otherClone = (FSA)autA.clone(); offset = stateMaxB; }  offset++;  for (Integer key : otherClone.getStates() ) { for ( Transition t : otherClone.getStateTransitions(key) ) { resultFSA.addTransition(t.getStartState()+offset, t.getEndState()+offset, t.getChar() ); } }  for (Integer state : otherClone.getStates() ) { resultFSA.setStartFlag(state+offset, otherClone.isStartState(state)); resultFSA.setFinalFlag(state+offset, otherClone.isFinalState(state)); }  resultFSA.setName(autA.getName()+"_union_"+autB.getName());   resultFSA = FSAAlgo.generatePositions(resultFSA);  return resultFSA;
    public static void autUnion(FSA autA, FSA autB) {                System.out.println("union: "+autA.getName()+" "+autB.getName());            }