code: public static String removeTrailingSeparator(String path) {
  
          int l = path.length();
          if ((l <= 1) || (path.charAt(l - 1) != '/')) {
              return path;
          } else {
              return path.substring(0, l - 1);
          }
      }
docs: Removes a trailing separator from a path if required.<p>
  
  In case we have the root folder "/", the separator is not removed.<p>
  
  @param path the path to remove the trailing separator from
  @return the path without a trailing separator