title: Concatenate Multiple variables to a String in Java If Else Block
body: <p>I need to create a string which becomes an input to a SHA 256 function to generate its hash equivalent. The string is created by concatenating several variables as below:</p>
  
  <pre><code>String strRequest = "";
  
  strRequest = request_passphrase.concat("access_code=").concat(access_code).concat("amount=").concat(amount).concat("command=").concat(mode).concat("currency=").concat(currency).concat("merchant_identifier=").concat(merchant_identifier).concat(request_passphrase);
  if(strRequest!="" || !strRequest.isEmpty()) {
    signature = sha256(strRequest);
  }
  </code></pre>
  
  <p>What should be the best way to create an if-else to drop concatenation for a variable which is null. </p>
  
  <p>For ex. if access_code is Null or empty, then the string will be request_passphrase.concat("amount=").concat(amount). and so on. </p>