@NonNls
  String calculateReplacementExpression(PsiPolyadicExpression expression, CommentTracker ct) {
    final IElementType tokenType = expression.getOperationTokenType();
    final PsiExpression[] operands = expression.getOperands();
    PsiExpression previousOperand = null;
    for (int i = 0, length = operands.length; i < length; i++) {
      final PsiExpression operand = operands[i];
      if (isZero(operand)) {
        if (tokenType.equals(AND) || ExpressionParser.SHIFT_OPS.contains(tokenType) && previousOperand == null) {
          return getText(expression, operands[0], operands[length - 1], PsiTypes.longType().equals(expression.getType()) ? "0L" : "0", ct);
        }
        else if (tokenType.equals(OR) || tokenType.equals(XOR) ||
                 ExpressionParser.SHIFT_OPS.contains(tokenType) && previousOperand != null) {
          return getText(expression, i == length - 1 ? expression.getTokenBeforeOperand(operand) : operand, ct);
        }
      }
      else if (isAllOnes(operand)) {
        if (tokenType.equals(AND)) {
          return getText(expression, i == length - 1 ? expression.getTokenBeforeOperand(operand) : operand, ct);
        }
        if (tokenType.equals(OR)) {
          return ct.text(operand);
        }
        else if (tokenType.equals(XOR)) {
          if (previousOperand != null) {
            return getText(expression, previousOperand, operand, getTildeReplacement(previousOperand, ct), ct);
          }
          else {
            final PsiExpression nextOperand = operands[i + 1];
            return getText(expression, operand, nextOperand, getTildeReplacement(nextOperand, ct), ct);
          }
        }
      }
      else if (EquivalenceChecker.getCanonicalPsiEquivalence().expressionsAreEquivalent(previousOperand, operand)) {
        if (tokenType.equals(OR) || tokenType.equals(AND)) {
          return getText(expression, previousOperand, operand, ct.text(operand), ct);
        }
        else if (tokenType.equals(XOR)) {
          return getText(expression, previousOperand, operand, PsiTypes.longType().equals(expression.getType()) ? "0L" : "0", ct);
        }
      }
      else {
        PsiExpression left = optionallyUnwrapComplement(previousOperand);
        PsiExpression right = optionallyUnwrapComplement(operand);
        if (EquivalenceChecker.getCanonicalPsiEquivalence().expressionsAreEquivalent(left, right)) {
          if (tokenType.equals(AND)) {
            return getText(expression, previousOperand, operand, PsiTypes.longType().equals(expression.getType()) ? "0L" : "0", ct);
          } else if (tokenType.equals(OR) || tokenType.equals(XOR)) {
            return getText(expression, previousOperand, operand, PsiTypes.longType().equals(expression.getType()) ? "-1L" : "-1", ct);
          }
        }
      }
      previousOperand = operand;
    }
    return "";
  }
@NonNls
  String calculateReplacementExpression(PsiPolyadicExpression expression, CommentTracker ct)