String (PsiExpression expression, PsiLocalVariable variable) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (expression == null) { return null; } if (ExpressionUtils.isZero(expression)) { return "0"; } final String expressionText = expression.getText(); final String variableName = variable.getName(); if (expressionText.equals(variableName)) { return "0"; } if (expression instanceof PsiBinaryExpression binaryExpression) { final PsiExpression lhs = binaryExpression.getLOperand(); final PsiExpression rhs = binaryExpression.getROperand(); final String rhsText = getIndexOffset(rhs, variable); final PsiJavaToken sign = binaryExpression.getOperationSign(); final IElementType tokenType = sign.getTokenType(); if (ExpressionUtils.isZero(lhs)) { if (tokenType.equals(JavaTokenType.MINUS)) { return '-' + rhsText; } return rhsText; } final String lhsText = getIndexOffset(lhs, variable); if (ExpressionUtils.isZero(rhs)) { return lhsText; } return collapseConstant(lhsText + " " + sign.getText() + " " + rhsText, variable); } return collapseConstant(expressionText, variable); }