This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Ideally with proper data type you should get 320 as answer but as it exceeds the capacity of a byte most significant bits (MSB) in binary representation is chopped of . Amount decimal reprn. of remaining bits is 64. i.e. 101000000 is 320 but if you try to fit that in byte first 10 is chopped of so you get 1000000 which is 64 in dec.
Hi, 64 is getting printed correctly. Let me explain how, z = 64 * 5 = 320 == 0x140 You are doing a type conversion (narrowing) on z, this drops the higher order bytes and takes only upto the bytes specified for the datatype, byte - 1 byte short - 2 bytes int - 4 bytes (byte)0x140 = 0x40 = 64 in decimal, so 64 is getting printed. ---------------------------- vijay