Convert byte to short in JavaCard
Вопрос
In java card only small data types are used (byte and short). I am trying to convert byte to short such that i can use it for checking condition,etc. When byte is converted into short using type cast in java card it gives me some other negative number. Please tell me how to convert (11111111) that is ff store in single byte to short.
I am using:
- smart card type = contact card
- using java card 2.2.2
- with jcop using apdu
Решение
Isn't the Java Card language simply the same as Java? Then you can write
shortvar = bytevar&0xFF;
Другие советы
You can use javacard.framework.Util.makeShort(byte b1, byte b2) method.
I know you have answer already but as far as I know good way is usage of javacard.framework.Util makeShort method when you'll give 2 bytes and it will return short.
Не связан с StackOverflow