code: public static String concatenateUrls(String rootUrl, String path) {
          if (rootUrl == null || rootUrl.isEmpty()) {
              return path;
          }
  
          if (path == null || path.isEmpty()) {
              return rootUrl;
          }
  
          String finalUrl;
  
          if (rootUrl.charAt(rootUrl.length() - 1) == '/' && path.charAt(0) == '/') {
              finalUrl = rootUrl.substring(0, rootUrl.length() - 2) + path;
          } else if (rootUrl.charAt(rootUrl.length() - 1) != '/' && path.charAt(0) != '/') {
              finalUrl = rootUrl + "/" + path;
          } else {
              finalUrl = rootUrl + path;
          }
  
          return finalUrl;
      }
docs: Concatenates two URLs. The function checks for trailing and preceding slashes in rootUrl and path.
  @param rootUrl first part of the url
  @param path second part of the url
  @return Concatenated string containing rootUrl and path.