code: private static String queryString( final Map<String, List<String>> params ) {
          final StringBuilder builder = new StringBuilder();
          if (params != null && params.size() > 0) {
              for (final Iterator<String> it = params.keySet().iterator(); it.hasNext(); ) {
                  final String key = it.next();
                  final List<String> values = params.get(key);
                  for (final String value : values) {
                      try {
                          builder.append(key + "=" + URLEncoder.encode(value, "UTF-8") + "&");
                      } catch (final UnsupportedEncodingException e) {
                          builder.append(key + "=" + value + "&");
                      }
                  }
              }
              return builder.length() > 0 ? "?" + builder.substring(0, builder.length() - 1) : "";
          }
          return "";
      }
docs: Encode URL parameters as a query string.
  @param params Query parameters