Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

How to know the first bit of a data byte

JavaCard Applet Development Related Questions and Answers.
Brewling
Posts: 12
Joined: Wed Jul 13, 2016 2:14 am
Points :144
Contact:

How to know the first bit of a data byte

Post by Brewling » Sun Jun 11, 2017 11:08 pm

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.

Tazmania09
Posts: 25
Joined: Mon Nov 30, 2015 3:40 am
Points :178
Contact:

Re: How to know the first bit of a data byte

Post by Tazmania09 » Mon Jun 12, 2017 4:01 am

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.

Brewling
Posts: 12
Joined: Wed Jul 13, 2016 2:14 am
Points :144
Contact:

Re: How to know the first bit of a data byte

Post by Brewling » Mon Jun 12, 2017 4:42 am

Wow, that a good idea. Thanks Tazmania09. You saved my day. :lol:

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 28 guests

JavaCard OS : Disclaimer