code: public static String getQueryStringFromParams(MultiValueMap<String, String> queryParams,
                                                    String charset, boolean encodeValues) throws UnsupportedEncodingException {
          StringBuilder queryString = new StringBuilder();
  
          if (MapUtils.isNotEmpty(queryParams)) {
              for (Map.Entry<String, List<String>> entry : queryParams.entrySet()) {
                  String paramName = URLEncoder.encode(entry.getKey(), charset);
  
                  for (String paramValue : entry.getValue()) {
                      if (queryString.length() > 0) {
                          queryString.append('&');
                      }
  
                      if (encodeValues) {
                          paramValue = URLEncoder.encode(paramValue, charset);
                      }
  
                      queryString.append(paramName).append('=').append(paramValue);
                  }
              }
  
              queryString.insert(0, '?');
          }
  
          return queryString.toString();
      }
docs: Builds a query string from the specified params. The param names are always encoded, but the values are only encoded
  if {@code encodeValues} is true.
  
  @param queryParams   the params to build the query string with
  @param charset       the charset to use for URL encoding
  @param encodeValues  if the param values should be encoded
  
  @return the query string