1 2 3 Previous Next 31 Replies Latest reply: Jul 26, 2007 12:00 PM by 807605 RSS

    How do Bitwise Operators work?

      Hi everybody

      I know a little bit of bitwise operators and I am getting some problems working with them.

      For example, imagine the byte 0x42 (Or 01000010). Now I want to build a long having this byte on the first position starting from the left so I try the following code:
      long l = 0x42 << 56;
      However, this operation seems to work like if I have written:
      long l = 0x42 << 24
      That is, the new long is a String of only 32 bits. Why does this command ignore the first 32 bits? Any ideas?
        1 2 3 Previous Next