public static Script createMultiSigOutputScript(int threshold,List<ECKey> pubkeys){
  checkArgument(threshold > 0);
  checkArgument(threshold <= pubkeys.size());
  checkArgument(pubkeys.size() <= 16);
  ScriptBuilder builder=new ScriptBuilder();
  builder.smallNum(threshold);
  for (  ECKey key : pubkeys) {
    builder.data(key.getPubKey());
  }
  builder.smallNum(pubkeys.size());
  builder.op(OP_CHECKMULTISIG);
  return builder.build();
}

public static Script createMultiSigOutputScript ( int threshold , List < ECKey > pubkeys ) { checkArgument ( threshold > 0 ) ; checkArgument ( threshold <= pubkeys . size ( ) ) ; checkArgument ( pubkeys . size ( ) <= 16 ) ; ScriptBuilder builder = new ScriptBuilder ( ) ; builder . smallNum ( threshold ) ; for ( ECKey key : pubkeys ) { builder . data ( key . getPubKey ( ) ) ; } builder . smallNum ( pubkeys . size ( ) ) ; builder . op ( OP_CHECKMULTISIG ) ; return builder . build ( ) ; }
creates a program that requires at least n of the given keys to sign , using op_checkmultisig .
