File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Some help with Shift operators 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 "Some help with Shift operators" Watch "Some help with Shift operators" New topic
Author

Some help with Shift operators

Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
I don't know about everyone else, but I just came across a methiod in the Integer class , which gives binary representation of any int.
You can try things like these and decide for yourself how different values get shifted.
System.out.println(Integer.toBinaryString(-1));
System.out.println(Integer.toBinaryString(2));
There is a similar method in the Long class as well.
Of course I'm sure every one knows of the toBinaryString () and toHexString() methods of Integer and Long classes.

Hope this helps
Arathi Rajashekar
Ranch Hand

Joined: Nov 20, 2001
Posts: 112
Thanks shivaji.
I never bothered of checking this. But now I got the idea. And one more thing, about passport book. Even I find lot of mistakes in that book. But there is no errata as per my knowledge. We have to write the code and we have to find the answer ourself


Arathi<br />Sun Certified Java Programmer
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
That book has such blatant errors. I bought it becuase it was written by a lot of ranchers. I assumed that it must be really good- the authors must have had first hand experience of studying for certification etc.
But I am thoroughly disappointed....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some help with Shift operators