public static Script createRedeemScript(int threshold,List<ECKey> pubkeys){
  pubkeys=new ArrayList<ECKey>(pubkeys);
  Collections.sort(pubkeys,ECKey.PUBKEY_COMPARATOR);
  return ScriptBuilder.createMultiSigOutputScript(threshold,pubkeys);
}

public static Script createRedeemScript ( int threshold , List < ECKey > pubkeys ) { pubkeys = new ArrayList < ECKey > ( pubkeys ) ; Collections . sort ( pubkeys , ECKey . PUBKEY_COMPARATOR ) ; return ScriptBuilder . createMultiSigOutputScript ( threshold , pubkeys ) ; }
creates redeem script with given public keys and threshold . given public keys will be placed in redeem script in the lexicographical sorting order .
