code: public static String getFirstPathComponent(String path) {
          File localf = new File(path);
          File last = localf;
          while (localf.getParentFile() != null) {
              last = localf;
              localf = localf.getParentFile();
          }
          return last.getName();
      }
docs: Obtains the 1st component of a path<p>
  Eg, for /wibble/fish will return wibble<br>
  for /we/like/pie will return we<br>
  for /fish will return fish<br>
  for sheep will return sheep<br>
  for / will return ""<br>
  
  @param path path to parse
  @return 1st path component.