This content has been marked as final. Show 5 replies
short smth = Util.makeShort( 0x00, 0xE8 )
Hi,1 person found this helpful
You could use this:
You can replace ISO7816.OFFSET_CDATA with the offset to the amount if your APDU becomes more complex. You can also validate that the Lc is 2 bytes. I am sure your stored value will not exceed 32,676 (max signed short)?
short amount = Util.getShort(apdu.getBuffer(), ISO7816.OFFSET_CDATA);
javacard.framework.Util; is what which i was looking for, it solved my problem..........
it helps to solve my problem, thanks bro
As a more general approach, when you have a byte that is greater than 0x7f and you want to make it an unsigned value you can use the following to prevent the sign extension:
short s = (short) (b & 0xff);