code: @SuppressWarnings("rawtypes")
      public static String toQueryString(Map params, String encoding) throws UnsupportedEncodingException {
          if (encoding == null) encoding = "UTF-8";
          StringBuilder queryString = new StringBuilder("?");
  
          for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
              Map.Entry entry = (Map.Entry) i.next();
              boolean hasMore = i.hasNext();
              boolean wasAppended = appendEntry(entry, queryString, encoding, "");
              if (hasMore && wasAppended) queryString.append('&');
          }
          return queryString.toString();
      }
docs: Converts the given params into a query string started with ?
  @param params The params
  @param encoding The encoding to use
  @return The query string
  @throws UnsupportedEncodingException If the given encoding is not supported