protected ScriptBuilder bigNum(int index,long num){
  final byte[] data;
  if (num == 0) {
    data=new byte[0];
  }
 else {
    Stack<Byte> result=new Stack<Byte>();
    final boolean neg=num < 0;
    long absvalue=Math.abs(num);
    while (absvalue != 0) {
      result.push((byte)(absvalue & 0xff));
      absvalue>>=8;
    }
    if ((result.peek() & 0x80) != 0) {
      result.push((byte)(neg ? 0x80 : 0));
    }
 else     if (neg) {
      result.push((byte)(result.pop() | 0x80));
    }
    data=new byte[result.size()];
    for (int byteIdx=0; byteIdx < data.length; byteIdx++) {
      data[byteIdx]=result.get(byteIdx);
    }
  }
  return addChunk(index,new ScriptChunk(data.length,data));
}

protected ScriptBuilder bigNum ( int index , long num ) { final byte [ ] data ; if ( num == 0 ) { data = new byte [ 0 ] ; } else { Stack < Byte > result = new Stack < Byte > ( ) ; final boolean neg = num < 0 ; long absvalue = Math . abs ( num ) ; while ( absvalue != 0 ) { result . push ( ( byte ) ( absvalue & 0xff ) ) ; absvalue >>= 8 ; } if ( ( result . peek ( ) & 0x80 ) != 0 ) { result . push ( ( byte ) ( neg ? 0x80 : 0 ) ) ; } else if ( neg ) { result . push ( ( byte ) ( result . pop ( ) | 0x80 ) ) ; } data = new byte [ result . size ( ) ] ; for ( int byteIdx = 0 ; byteIdx < data . length ; byteIdx ++ ) { data [ byteIdx ] = result . get ( byteIdx ) ; } } return addChunk ( index , new ScriptChunk ( data . length , data ) ) ; }
adds the given number as a push data chunk to the given index in the program . this is intended to use for negative numbers or values > 16 , and although it will accept numbers in the range 0 - 16 inclusive , the encoding would be considered non - standard .
