There is no need to convert this to infix - you want to get out of the domain of strings as quickly as possible, for example
public abstract class Expression
public abstract class BinaryExpression extends Expression {
private Expression expr1;
private Expression expr2;
public Expression getExpr1() { return expr1; }
public void setExpr1(Expression expr) { expr1 = expr; }
}
public abstract class UnaryExpression extends Expression
public class Or extends BinaryExpression
public class Not extends UnaryExpression
and so on. To parse the input into Expressions
you may find it useful to use a Recursive Descent Parser, although this is certainly not the only way to parse your input. Once you have your input converted to a symbolic Expression
format it should be much easier to apply the boolean laws to convert it to CNF.