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
Pie
Posts: 49793
69
  • 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