public static boolean isDirectory(File dir){
  return dir.exists() && dir.isDirectory();
}

public static boolean isDirectory ( File dir ) { return dir . exists ( ) && dir . isDirectory ( ) ; }
returns true if the directory exists .
