byte, short, int, and long's values are signed two's complement integers. Only char is unsigned. When a shift operation is performed unary numeric promotion is performed on each operand separately. If the left-hand operand is a byte, short or char, it is promoted to int. If the left-hand operand is int or long, there is no promotion.
Make sure you find some material about how bytes and shorts are treated with the shift operator. Because a byte and short are promoted to an int before the operation, the results you can get from shifting a byte or short can be unexpected.
Joined: May 17, 2003
thanx Brian and Valentin i looked thru some material and 'm clearer abt it.