code: public static String removeTrailingSlash(String path)
    {
      if(path.endsWith("/"))
        return path.substring(0, path.length() - 1);
      else
        return path;
    }
docs: Removes a trailing slash if exists
  
  @param path
  @return the path without a trailing /