This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

ShiftWise operator

 
Vidya Lakshman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator



what is the output of the above code & explain the working? Why is the code highlighted giving -ve value as the output?
Any help is highly appreciated.


Regards
Vidya
 
Don Redd
Ranch Hand
Posts: 82
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
1073741818 => 00111111 11111111 11111111 11111010
-24 ====> 11111111 11111111 11111111 11101000
-6 ====> 11111111 11111111 11111111 11111010

+24 ====> 00000000 00000000 00000000 00011000
+6 ====> 00000000 00000000 00000000 00000110

and you can use below URL to work out

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html
 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Report post to moderator
I shall take the liberty of closing this thread; read this.
 
    Bookmark Topic Watch Topic
  • New Topic