boolean (PsiElement element) { if (!(element instanceof PsiJavaToken keyword)) { return false; } final IElementType tokenType = keyword.getTokenType(); if (!JavaTokenType.FOR_KEYWORD.equals(tokenType)) { return false; } final PsiElement parent = keyword.getParent(); if (!(parent instanceof PsiForStatement forStatement)) { return false; } final PsiStatement initialization = forStatement.getInitialization(); if (!(initialization instanceof PsiDeclarationStatement declarationStatement)) { return false; } final PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); if (declaredElements.length != 1) { return false; } final PsiElement declaredElement = declaredElements[0]; if (!(declaredElement instanceof PsiLocalVariable)) { return false; } final PsiVariable variable = (PsiVariable)declaredElement; if (variable.getInitializer() == null) { return false; } final PsiType type = variable.getType(); if (!PsiTypes.intType().equals(type) && !PsiTypes.longType().equals(type)) { return false; } final PsiExpression condition = PsiUtil.skipParenthesizedExprDown(forStatement.getCondition()); if (!isVariableCompared(variable, condition)) { return false; } final PsiStatement update = forStatement.getUpdate(); return isVariableIncrementOrDecremented(variable, update); }