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.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes casting problem...from long to byte.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "casting problem...from long to byte.." Watch "casting problem...from long to byte.." New topic
Author

casting problem...from long to byte..

amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 812
Hi,
I m preparing for scjp and refering book by bertbates/kathy seera...

I m not able to clear one funda that while explicit casting from long to byte... when the value is greater then +127.

in that book ... in one page there is written about removing of higher order bits left to 8 lower order bits...and if last bit left in that 8 bits is 1 then the no. will be negative of remaining 7 bits

but in other page its witten about complement notation... i.e to find out the complement of the no. and add 1 to it..and then find out the final no. stored in byte...?

can any body pls tell me whats is all about and what is truth ..and even when we follow complement startergy but why so ???


answer in details ..

thanx and regards,
amit


Thanks and Regards, Amit Taneja
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: casting problem...from long to byte..
 
It's not a secret anymore!