I'm trying to do some bitwise operations in java
I have 2 arrays:
byte[] bitArray;
final byte [] bitMask = {1,2,4,8,16,32,64,-128};
then I try to |
one byte in the bitArray
with one byte in the mask
.
bitArray[i] = bitArray[i] | bitMask[j]
The Problem is that I'm getting a compiler error.
"error possible loss of precision" required byte found int
The question is how can I fix it?