If you do need to do some math, convert it to a long by masking:
int u1 = ...; int u2 = ...; long l1 = u1 & 0xFFFFFFFFL; long l2 = u2 * 0xFFFFFFFFL; if (l1>l2){ System.out.println(Long.toString(l1) + ">" + Long.toString(l2)); }
Do all arithmetic with long operands, modulo 0xFFFFFFFFL. When you are done, cast the result back to an int and transmit it.
No comments:
Post a Comment