I need to perform an overflow if a variable is greater than 65535 so that 65536 equals 0. Likewise, if the number is less than 0 I need to underflow so that -1 equals 65535. How is this performed in Java? Thanks, Drew
Would it also be possible to do this with some kind of bit shift? Or could I extract the last 16 bits? Not sure what the Java syntax is, however. (?) Drew
use & operator to bitwise AND the number with mask 0xFFFF to get the last 16 bits. then use Integer.toBinaryString(int i) to get the result in binary form.
not so smart guy still curious to learn new stuff every now and then