code: public static String addParameter(final String url, final String name, final String value) {
          if (url != null) {
              final StringBuilder sb = new StringBuilder();
              sb.append(url);
              if (name != null) {
                  if (url.indexOf("?") >= 0) {
                      sb.append("&");
                  } else {
                      sb.append("?");
                  }
                  sb.append(name);
                  sb.append("=");
                  if (value != null) {
                      sb.append(urlEncode(value));
                  }
              }
              return sb.toString();
          }
          return null;
      }
docs: Add a new parameter to an url.
  
  @param url   url
  @param name  name of the parameter
  @param value value of the parameter
  @return the new url with the parameter appended