private static boolean isDirectory(URL url){
  String file=url.getFile();
  return (file.length() > 0 && file.charAt(file.length() - 1) == '/');
}

private static boolean isDirectory ( URL url ) { String file = url . getFile ( ) ; return ( file . length ( ) > 0 && file . charAt ( file . length ( ) - 1 ) == '/' ) ; }
determines if the url is pointing to a directory .
