byte sorting

L

lascar

I'm trying to write some java code in order to talk to a RFID device.
The protocol I must follow (ISO don't recall what number) asks for every
query to end with a CRC.
This CRC must be expressed in a 'least significant byte first' and,
within a byte, 'least significant bit first'.
I can decide the order of my 2 CRC bytes. Shall I also work on bitwise
operations in order to set all bits properly, or is this something
implicit within the java architecture?
Thanks,
Las
 
J

John C. Bollinger

lascar said:
I'm trying to write some java code in order to talk to a RFID device.
The protocol I must follow (ISO don't recall what number) asks for every
query to end with a CRC.
This CRC must be expressed in a 'least significant byte first' and,
within a byte, 'least significant bit first'.
I can decide the order of my 2 CRC bytes. Shall I also work on bitwise
operations in order to set all bits properly, or is this something
implicit within the java architecture?

Java integer types are logically big-endian with respect to byte order,
and logically big-endian with respect to bit order within any byte.
(How these things are expressed in the underlying hardware is
irrelevant.) Java I/O and networking API will not perform bit
reordering for you.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top