Dennis,
From the java language specification, it says:
The value of n>>>s is n right-shifted s bit positions with zero-extension.
If n is positive, then the result is the same as that of n>>s; if n is
negative, the result is equal to that of the expression (n>>s)+(2<<~s) if
the type of the left-hand operand is int
So, if you have an integer in a variable n, you can do this:
// First, shift over two bits.
int pintResult = n >> s;
// Now, if it is negative, perform an additional operation.
if (pintResult < 0)
// Modify.
pintResult += (2 << ~s);
Hope this helps.