I use a technology called DDS and in IDL, it does not support int . So, I decided that I was just using short . I don't need so many bits. However, when I do this:
short bit = 0; System.out.println(bit); bit = bit | 0x00000001; System.out.println(bit); bit = bit & ~0x00000001; bit = bit | 0x00000002; System.out.println(bit);
It says: "Type of mismatch: cannot be converted from int to short." When I change short to long , it works fine.
Is it possible to perform bitwise operations like this on short in Java?
user195488
source share