private static boolean isArrayLength(PsiLocalVariable arrayVariable, PsiExpression dimension, PsiExpression bound) {
    if (ExpressionUtils.isReferenceTo(ExpressionUtils.getArrayFromLengthExpression(bound), arrayVariable)) return true;
    if (EquivalenceChecker.getCanonicalPsiEquivalence().expressionsAreEquivalent(dimension, bound)) return true;
    if (bound instanceof PsiMethodCallExpression) {
      PsiExpression qualifier = ((PsiMethodCallExpression)bound).getMethodExpression().getQualifierExpression();
      if (qualifier != null && CollectionUtils.isCollectionOrMapSize(dimension, qualifier)) return true;
    }
    if (dimension instanceof PsiMethodCallExpression) {
      PsiExpression qualifier = ((PsiMethodCallExpression)dimension).getMethodExpression().getQualifierExpression();
      if (qualifier != null && CollectionUtils.isCollectionOrMapSize(bound, qualifier)) return true;
    }
    return false;
  }
private static boolean isArrayLength(PsiLocalVariable arrayVariable, PsiExpression dimension, PsiExpression bound)