boolean (PsiExpression expression, Project project) { PsiBinaryExpression binOp = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprDown(expression), PsiBinaryExpression.class); if (binOp == null || !binOp.getOperationTokenType().equals(JavaTokenType.LTLT)) return false; PsiConstantEvaluationHelper helper = JavaPsiFacade.getInstance(project).getConstantEvaluationHelper(); Object lOperandValue = helper.computeConstantExpression(binOp.getLOperand()); Object rOperandValue = helper.computeConstantExpression(binOp.getROperand()); if (lOperandValue instanceof Character) lOperandValue = (int)((Character)lOperandValue).charValue(); if (rOperandValue instanceof Character) rOperandValue = (int)((Character)rOperandValue).charValue(); if (!(lOperandValue instanceof Number) || !(rOperandValue instanceof Number)) return false; if (lOperandValue instanceof Long) { long l = ((Number)lOperandValue).longValue(); long r = ((Number)rOperandValue).longValue(); return Long.numberOfLeadingZeros(l) - (r & 0x3F) == 0; } else { int l = ((Number)lOperandValue).intValue(); int r = ((Number)rOperandValue).intValue(); return Integer.numberOfLeadingZeros(l) - (r & 0x1F) == 0; } }