JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
How to know the first bit of a data byte
How to know the first bit of a data byte
When I receive an APDU command, I have to see the first bit of the first data byte,1 or 0.
Is there an easier way to see an specific bit from a byte in java card?
Thanks a lot for any help.
Is there an easier way to see an specific bit from a byte in java card?
Thanks a lot for any help.
-
- Posts: 25
- Joined: Mon Nov 30, 2015 3:40 am
- Points :178
- Contact:
Re: How to know the first bit of a data byte
You may try to use AND operation to know the bit value.
For example,
Make your data do the AND operation with 0x80.
So,
- if it is 1 in the first bit, the operation result will be 0x80.
- and if it is 0 in the first bit,the operation result will be 0.
For example,
Make your data do the AND operation with 0x80.
So,
- if it is 1 in the first bit, the operation result will be 0x80.
- and if it is 0 in the first bit,the operation result will be 0.
Re: How to know the first bit of a data byte
Wow, that a good idea. Thanks Tazmania09. You saved my day. 

Who is online
Users browsing this forum: No registered users and 20 guests