void (PsiBinaryExpression expression) { final PsiExpression lhs = expression.getLOperand(); final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(expression.getROperand()); final IElementType tokenType = expression.getOperationTokenType(); final String operatorString; if (tokenType.equals(JavaTokenType.ASTERISK)) { operatorString = "<<"; } else { operatorString = ">>"; } final String lhsText; if (ParenthesesUtils.getPrecedence(lhs) > ParenthesesUtils.SHIFT_PRECEDENCE) { lhsText = '(' + lhs.getText() + ')'; } else { lhsText = lhs.getText(); } String expString = lhsText + operatorString + ShiftUtils.getLogBase2(rhs); final PsiElement parent = expression.getParent(); if (parent instanceof PsiExpression) { if (!(parent instanceof PsiParenthesizedExpression) && ParenthesesUtils.getPrecedence((PsiExpression)parent) < ParenthesesUtils.SHIFT_PRECEDENCE) { expString = '(' + expString + ')'; } } CommentTracker commentTracker = new CommentTracker(); commentTracker.markUnchanged(lhs); PsiReplacementUtil.replaceExpression(expression, expString, commentTracker); }