((JVariableDeclarationStatement)init).getVars()[0].getIdent().equals(var.getIdent())) {
((JVariableDeclarationStatement)init).getVars()[0].getIdent().equals(var.getIdent()) && ((JVariableDeclarationStatement)init).getVars()[0].getValue() instanceof JIntLiteral) {
    public static LoopIterInfo getLoopInfo(JStatement init,                                           JExpression cond,                                           JStatement incr,                                           JStatement body,                                           Map /*<JLocalVariable>,<JIntLiteral>*/<JLocalVariable, JExpression> values,                                           Map /*<JLocalVariable>,<JIntLiteral>*/ constants) {        try {            JLocalVariable var;            int initVal=0;            int finalVal=0;            boolean isDeclaredInInit = false;            //boolean incrementing;            // inspect condition...            JRelationalExpression condExpr = (JRelationalExpression)cond;            int relation=condExpr.getOper();            var=((JLocalVariableExpression)condExpr.getLeft()).getVariable();            if(init instanceof JExpressionListStatement || init instanceof JExpressionStatement) {                JAssignmentExpression initExpr;                if (init instanceof JExpressionListStatement) {                    if (((JExpressionListStatement)init).getExpressions().length != 1) {                        throw new Exception("Can't decipher initialization");                    }                    initExpr = (JAssignmentExpression)                        ((JExpressionListStatement)init).getExpression(0);                } else {                    initExpr = (JAssignmentExpression)((JExpressionStatement)init).getExpression();                }                if(((JLocalVariableExpression)initExpr.getLeft()).getVariable()==var)                    initVal                         = ((JIntLiteral)initExpr.getRight()).intValue();                else if(values.containsKey(var))                    initVal=((JIntLiteral)values.get(var)).intValue();                else if(constants.containsKey(var))                    initVal=((JIntLiteral)constants.get(var)).intValue();                else {                    throw new Exception("Not Constant!");                }            } else if (init instanceof JVariableDeclarationStatement &&                    ((JVariableDeclarationStatement)init).getVars()[0].getIdent().equals(var.getIdent())) {                initVal = ((JIntLiteral)((JVariableDeclarationStatement)init).getVars()[0].getValue()).intValue();                isDeclaredInInit = true;            } else if(values.containsKey(var)) {                initVal=((JIntLiteral)values.get(var)).intValue();            } else {                throw new Exception("Not Constant!");            }            // get the upper limit            if(condExpr.getRight() instanceof JIntLiteral) {                finalVal = ((JIntLiteral)condExpr.getRight()).intValue();                if(relation==OPE_LE)                    finalVal++;                else if(relation==OPE_GE)                    finalVal--;            } else {                // if we can't get the upper limit, then we don't know                // how much to unroll, so fail                return null;            }            //else            //System.err.println("Cond: "+((JFieldAccessExpression)condExpr.getRight()).isConstant());            // inspect increment...            int incrVal, oper;            JLocalVariableExpression incrVar;            JExpression incrExpr;            if(incr instanceof JExpressionListStatement)                incrExpr =                    ((JExpressionListStatement)incr).getExpression(0);            else {                incrExpr =                    ((JExpressionStatement)incr).getExpression();            }            if (incrExpr instanceof JCompoundAssignmentExpression)                {                    JCompoundAssignmentExpression cae =                        (JCompoundAssignmentExpression)incrExpr;                    oper = cae.getOperation();                    incrVal = ((JIntLiteral)cae.getRight()).intValue();                    incrVar =                        (JLocalVariableExpression)cae.getLeft();                }            else if(incrExpr instanceof JAssignmentExpression){                JAssignmentExpression ae=(JAssignmentExpression)incrExpr;                //oper = ae.getOperation();                //incrVal=((JIntLiteral)ae.getRight()).intValue();                incrVar=(JLocalVariableExpression)ae.getLeft();                JBinaryExpression expr=(JBinaryExpression)ae.getRight();                if(expr instanceof JDivideExpression) {                    if(!((JLocalVariableExpression)expr.getLeft()).equals(incrVar)) {                        //System.err.println("Vars don't match!");                        return null;                    }                    incrVal=((JIntLiteral)expr.getRight()).intValue();                    oper=OPE_SLASH;                } else if(expr instanceof JMultExpression) {                    oper=OPE_STAR;                    if(expr.getLeft() instanceof JLocalVariableExpression) {                        if(!((JLocalVariableExpression)expr.getLeft()).equals(incrVar)) {                            return null;                        }                        incrVal=((JIntLiteral)expr.getRight()).intValue();                    } else if(expr.getRight() instanceof JLocalVariableExpression) {                        if(!((JLocalVariableExpression)expr.getRight()).equals(incrVar)) {                            return null;                        }                        incrVal=((JIntLiteral)expr.getLeft()).intValue();                    } else {                        return null;                    }                } else if(expr instanceof JAddExpression) {                    oper=OPE_PLUS;                    if(expr.getLeft() instanceof JLocalVariableExpression) {                        if(!((JLocalVariableExpression)expr.getLeft()).equals(incrVar)) {                            return null;                        }                        incrVal=((JIntLiteral)expr.getRight()).intValue();                    } else if(expr.getRight() instanceof JLocalVariableExpression) {                        if(!((JLocalVariableExpression)expr.getRight()).equals(incrVar)) {                            return null;                        }                        incrVal=((JIntLiteral)expr.getLeft()).intValue();                    } else                         return null;                } else if(expr instanceof JMinusExpression) {                    if(!((JLocalVariableExpression)expr.getLeft()).equals(incrVar)) {                        //System.err.println("Vars don't match!");                        return null;                    }                    incrVal=((JIntLiteral)expr.getRight()).intValue();                    oper=OPE_MINUS;                } else {                    return null;                }            } else if (incrExpr instanceof JPrefixExpression)                {                    JPrefixExpression pfx = (JPrefixExpression)incrExpr;                    oper = pfx.getOper();                    incrVal = 1;                    incrVar = (JLocalVariableExpression)pfx.getExpr();                }            else if (incrExpr instanceof JPostfixExpression)                {                    JPostfixExpression pfx = (JPostfixExpression)incrExpr;                    oper = pfx.getOper();                    incrVal = 1;                    incrVar = (JLocalVariableExpression)pfx.getExpr();                }            else {                return null;            }                    // make sure the variable is the same            if (var != incrVar.getVariable()) {                return null;            }            //Not have to worry about weird cases            if(incrVal==0) {                return null;            } else if(((oper==OPE_STAR)||(oper==OPE_SLASH))&&incrVal<2) {                return null;            }                    //Normalize + and -            if((oper==OPE_PLUS)&&(incrVal<0)) {                oper=OPE_MINUS;                incrVal*=-1;            } else if((oper==OPE_MINUS)&&(incrVal<0)) {                oper=OPE_PLUS;                incrVal*=-1;            }            //Check to make sure we are incrementing to a ceiling            //or decrementing to a floor            if((((oper==OPE_PLUS)||(oper==OPE_STAR)||(oper==OPE_POSTINC)||(oper==OPE_PREINC))&&((relation==OPE_GE)||(relation==OPE_GT)))||               (((oper==OPE_MINUS)||(oper==OPE_SLASH)||(oper==OPE_POSTDEC)||(oper==OPE_PREDEC))&&((relation==OPE_LE)||(relation==OPE_LT)))) {                return null;            }            // return result            return new LoopIterInfo(var, initVal, finalVal, oper, incrVal, isDeclaredInInit);        } catch (Exception e) {            // uncommment these lines if you want to trace a case of something            // not unrolling ---                    //System.err.println("Didn't unroll because:");            //e.printStackTrace();                    // assume we failed 'cause assumptions violated -- return null            return null;        }    }