code: public static String buildPath(String... paths) {
          if (paths == null || paths.length == 0) {
              throw new IllegalArgumentException("Path must at least contain one element");
          }
  
          StringBuilder path = new StringBuilder();
          for (int i = 0; i < paths.length; i++) {
              String p = paths[i];
              if (p == null) continue;
  
              //skip separator if one already present
              if (p.charAt(0) != '/') {
                  path.append('/');
              }
              //remove trailing /
              if (p.charAt(p.length() - 1) == '/') {
                  path.append(p, 0, p.length() - 1);
              } else {
                  path.append(p);
              }
          }
          return path.toString();
      }
docs: Assemble path elements to form an HTTP path:
  - if an element starts with a slash, it is kept. Otherwise a trailing slash is added.
  - if an element ends with a slash, it is removed.
  - if an element is null, it is ignored.
  
  @param paths the elements of the path.
  @return returns the full path.