aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 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 "shift operators" Watch "shift operators" New topic
Author

shift operators

Richa Jeetah
Greenhorn

Joined: Sep 27, 2001
Posts: 29
Hi
I know how each works...but i have some difficulty in calculating the values when given to actually solve a few examples.
whats the easiest way to calculate the answers for these operaators.
i read somewhere that
x << y can be interpreted as x*2^y
and x>>y as x/y ^2
how does it work ??
when i tried it ..... it gave diff results.
whats the best way to do it ??
if given : 8>>3
i try to convert it to binary and then perform the operation and convert it back..
it fine if the number is low...
but i fail to apply the same when given
24>>4 or 33>> 4 ... etc
Please Help !
Vin Kris
Ranch Hand

Joined: Jun 17, 2002
Posts: 154
Hi Richa, check out these....
http://www.danchisholm.net/tutorials/baseconvert.html
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/bin_dec_hex.html
http://www.duke.edu/~twf/cps104/twoscomp.html
Richa Jeetah
Greenhorn

Joined: Sep 27, 2001
Posts: 29
thanx
it helped
 
Consider Paul's rocket mass heater.
 
subject: shift operators