public ScriptBuilder data(int index,byte[] data){
  byte[] copy=Arrays.copyOf(data,data.length);
  int opcode;
  if (data.length == 0) {
    opcode=OP_0;
  }
 else   if (data.length == 1) {
    byte b=data[0];
    if (b >= 1 && b <= 16)     opcode=Script.encodeToOpN(b);
 else     opcode=1;
  }
 else   if (data.length < OP_PUSHDATA1) {
    opcode=data.length;
  }
 else   if (data.length < 256) {
    opcode=OP_PUSHDATA1;
  }
 else   if (data.length < 65536) {
    opcode=OP_PUSHDATA2;
  }
 else {
    throw new RuntimeException("Unimplemented");
  }
  return addChunk(index,new ScriptChunk(opcode,copy));
}

public ScriptBuilder data ( int index , byte [ ] data ) { byte [ ] copy = Arrays . copyOf ( data , data . length ) ; int opcode ; if ( data . length == 0 ) { opcode = OP_0 ; } else if ( data . length == 1 ) { byte b = data [ 0 ] ; if ( b >= 1 && b <= 16 ) opcode = Script . encodeToOpN ( b ) ; else opcode = 1 ; } else if ( data . length < OP_PUSHDATA1 ) { opcode = data . length ; } else if ( data . length < 256 ) { opcode = OP_PUSHDATA1 ; } else if ( data . length < 65536 ) { opcode = OP_PUSHDATA2 ; } else { throw new RuntimeException ( "Unimplemented" ) ; } return addChunk ( index , new ScriptChunk ( opcode , copy ) ) ; }
adds a copy of the given byte array as a data element ( i . e . pushdata ) at the given index in the program .
