Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem when trying to XOR two bytes

807607Dec 29 2006 — edited Dec 29 2006
I am trying to XOR two bytes.. this is the code
    byte A = 0x55;
    byte B = A ^ 0x45;
On compiling, this is the error i get:
possible loss of precision
found   : int
required: byte
    byte B = A ^ 0x45;
Any idea whats going wrong?

I can't use any other data type as in my actual code the data is an array of bytes.

Thanks for your help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2007
Added on Dec 29 2006
10 comments
445 views