code: public static <T extends Map.Entry<String, String>> void formEncode(Collection<T> parameters,
              OutputStream into) throws IOException {
          if (parameters != null) {
              boolean first = true;
              for (Map.Entry<String, String> entry : parameters) {
                  if (first) {
                      first = false;
                  } else {
                      into.write('&');
                  }
                  into.write(percentEncode(safeToString(entry.getKey())).getBytes());
                  into.write('=');
                  into.write(percentEncode(safeToString(entry.getValue())).getBytes());
              }
          }
      }
docs: Construct a x-www-form-urlencoded document containing the given sequence
  of name/value pairs. Use OAuth percent encoding (not exactly the encoding
  mandated by x-www-form-urlencoded).