code: public static String joinURL(String base, String... paths) throws MalformedURLException {
          StringBuilder result = new StringBuilder(base);
          for (String path : paths) {
              String p = path.replaceFirst("^(\\/)+", "");
              if (result.lastIndexOf("/") != result.length() - 1) {
                  result.append('/');
              }
              result.append(p);
          }
          return result.toString();
      }
docs: join a base url to another path or paths - this will handle trailing or non-trailing /'s