code: private String normalizePath(String path) {
  
  		// remove leading and tailing whitespaces
  		path = path.trim();
  
  		// remove consecutive slashes & backslashes
  		path = path.replace("\\", "/");
  		path = path.replaceAll("/+", "/");
  
  		// remove tailing separator
  		if (path.endsWith(SEPARATOR) &&
  				!path.equals(SEPARATOR) &&              // UNIX root path
  				!WINDOWS_ROOT_DIR_REGEX.matcher(path).matches()) {  // Windows root path)
  
  			// remove tailing slash
  			path = path.substring(0, path.length() - SEPARATOR.length());
  		}
  
  		return path;
  	}
docs: Normalizes a path string.
  
  @param path
  the path string to normalize
  @return the normalized path string