code: public static void checkValidDir(final File dir) {
          checkNotNull("dir", dir);
          if (!dir.exists()) {
              throw new IllegalArgumentException("The directory '" + dir + "' does not exist!");
          }
          if (!dir.isDirectory()) {
              throw new IllegalArgumentException("The name '" + dir + "' is not a directory!");
          }
      }
docs: Check if the argument is an existing directory. If the check fails an <code>IllegalArgumentException</code> is thrown.
  
  @param dir
  Directory to check - Cannot be <code>null</code>.