When the number of positions being shifted
exceeds the length of the datatype( in bytes ), the actual shift occurs only by ( numPositions % datatypeSizeInBytes ) positions.
ie.,
when you shift an integer by X positions where X is greater than 32, the actual positions shifted is not X, but ( X % 32 )
Similarly, when you shift a long by X positions where X is greater than 64, the actual positions shifted is not X, but ( X % 64 ).
Now lets look at the line
int i=(-1>>65535)+1;
Since 65535 is greater than 32, you will first have to figure out the actual number of positions for the shift. Use the formula mentioned above.
int i=(-1>>(65535%32)) + 1;
ie., int i=( -1>>31 ) + 1;
-1 >> 31 is -1 so the answer is 0.
Cheers!
------------------
Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
[This message has been edited by Ajith Kallambella (edited May 02, 2001).]