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.
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
Joined: Jan 11, 2002
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....