code: public Sha256Hash hashForSignature(int inputIndex, Script redeemScript,
                                                      SigHash type, boolean anyoneCanPay) {
          int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay);
          return hashForSignature(inputIndex, redeemScript.getProgram(), (byte) sigHash);
      }
docs: <p>Calculates a signature hash, that is, a hash of a simplified form of the transaction. How exactly the transaction
  is simplified is specified by the type and anyoneCanPay parameters.</p>
  
  <p>This is a low level API and when using the regular {@link Wallet} class you don't have to call this yourself.
  When working with more complex transaction types and contracts, it can be necessary. When signing a P2SH output
  the redeemScript should be the script encoded into the scriptSig field, for normal transactions, it's the
  scriptPubKey of the output you're signing for.</p>
  
  @param inputIndex input the signature is being calculated for. Tx signatures are always relative to an input.
  @param redeemScript the script that should be in the given input during signing.
  @param type Should be SigHash.ALL
  @param anyoneCanPay should be false.