Java does not have primitives for unsigned integers.
Comparisons of unsigned quantities can be achieved by adding
MIN_VALUE to both sides of a signed inequality. For example:
public class ULong {
private long value;
public boolean gt(long ulong) {
return value + Long.MIN_VALUE > ulong + Long.MIN_VALUE;
}
}
When the machine architecture supports unsigned comparisions, as is
the case for SPARC, the compiler can recognize this idiom and utilize
the unsigned comparison instructions.
Note that the use of + in the method gt() above can correctly be replaced
with either - or ^. (The desired effect is the flipping of the sign bit.)