Have you looked at the ScriptBuilder class? The number() method should allow negative values.
On 10/12/2017 02:18 PM, mshikha...@gmail.com wrote: > Hi all, > I want to execute a simple series of instructions to implement a bitcoin > script in java using bitcoinj API. All I am looking for is performing > arithmetic operations for negative integers or integers greater than > 128. An example bitcoin script for the task would look like this: > > |150 120 OP_ADD 270 OP_CHECKNUMEQUAL| > > This script should return True eventually. To implement this in java, to > push integer values like 150, 270 etc i have to first convert them to > byte arrays. I have followed answers given in Convert integer into byte > array (Java) > <https://stackoverflow.com/questions/1936857/convert-integer-into-byte-array-java> > but > none of them works in here probably because of differently defined > arithmetic operations in bitcoinj API script. Can anyone please help me > in this. Much thanks in advance! > > Best, > > -- > You received this message because you are subscribed to the Google > Groups "bitcoinj" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to bitcoinj+unsubscr...@googlegroups.com > <mailto:bitcoinj+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "bitcoinj" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoinj+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.