byte b = 4; long x = b << 56; // does not work, since shift done modulo 32 and result is int. long x = ( ong)b << 56; // correct