public static boolean isPackageEmpty(PsiDirectory @NotNull [] directories, @NotNull String packageName) {
    for (PsiDirectory directory : directories) {
      for (PsiFile file : directory.getFiles()) {
        if (file instanceof PsiClassOwner &&
            packageName.equals(((PsiClassOwner)file).getPackageName()) &&
            ((PsiClassOwner)file).getClasses().length > 0) {
          return false;
        }
      }
    }

    return true;
  }
public static boolean isPackageEmpty(PsiDirectory @NotNull [] directories, @NotNull String packageName)