int (PsiMethod[] methods, boolean ignoreMainMethod) { int staticCount = 0; for (PsiMethod method : methods) { if (method.isConstructor()) { continue; } if (!method.hasModifierProperty(PsiModifier.STATIC)) { return -1; } if (method.hasModifierProperty(PsiModifier.PRIVATE)) { continue; } if (ignoreMainMethod && method.getName().equals("main") && PsiMethodUtil.isMainMethod(method)) { continue; } staticCount++; } return staticCount; }