title: Java: Passing multiple parameters to a method
body: <p>What is the proper way to pass multiple parameters to a method and then put those parameters into a payload?</p>
  
  <p>The method should send an HTTP request w/ payload to a server (and receive a response from it) and this works just fine:</p>
  
  <pre><code>public static JSONObject myMethod(String parameterOne, JSONArray parameterTwo, String parameterThree, long parameterFour) {
  
      ...
  
      HttpPost request = new HttpPost(url);
      request.addHeader("Content-Type", "application/json");
  
      JSONObject payload = new JSONObject();
      payload.put("parameterOne", parameterOne);
      payload.put("parameterTwo", parameterTwo);
      payload.put("parameterThree", parameterThree);
      payload.put("parameterFour", parameterFour);
  
      request.setEntity(new StringEntity(payload.toString()));
  
      ...
  </code></pre>
  
  <p>However, I believe that there should be another, more efficient (and aesthetic) way to perform this.</p>