Integer (@NotNull PsiVariable targetBuilder, @NotNull PsiMethodCallExpression truncateCall) { PsiExpression[] expressions = truncateCall.getArgumentList().getExpressions(); if (expressions.length == 0) return null; PsiExpression parameter = expressions[0]; if (parameter == null) return null; PsiBinaryExpression binaryExpression = tryCast(parameter, PsiBinaryExpression.class); if (binaryExpression == null || !binaryExpression.getOperationTokenType().equals(JavaTokenType.MINUS)) return null; PsiExpression lOperand = binaryExpression.getLOperand(); PsiExpression rOperand = binaryExpression.getROperand(); if (rOperand == null) return null; Object constantExpression = ExpressionUtils.computeConstantExpression(rOperand); if (!(constantExpression instanceof Integer)) return null; int truncationSize = (int)constantExpression; PsiMethodCallExpression lengthCall = tryCast(lOperand, PsiMethodCallExpression.class); if (!LENGTH.test(lengthCall)) return null; PsiLocalVariable variable = resolveLocalVariable(lengthCall.getMethodExpression().getQualifierExpression()); if (variable == null || !variable.equals(targetBuilder)) return null; return truncationSize; }