wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes what would be the result of this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what would be the result of this " Watch "what would be the result of this " New topic
Author

what would be the result of this

sura watthana
Ranch Hand

Joined: Sep 13, 2004
Posts: 77
Could anyone help me out?
what would be the result of this
(-1>> 1)

and

(-1>>>1)

and

(-42>>-4) and why

thanks
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
What happened when you tried them?


Mike Gershman
SCJP 1.4, SCWCD in process
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Sura,

Check out Corey McGlone's Bit Shifting for explanation.


Output:
11111111111111111111111111111111
11111111111111111111111111111111

Joyce
[ November 18, 2004: Message edited by: Joyce Lee ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what would be the result of this