File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shift Operators

 
Ritu Kapoor
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am terribly bad in shift operators. I have to learn shift operators. Can anyone pls help me with any url containing articles on shift operators.

Thanks & Regards,
Ritu
 
vinay vishal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read This Book -> Complete Reference Java-2 or java-5
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Corey's TipLine article on bit shifting. See the link at the top of this forum for more of Corey's articles.
 
Gitesh Ramchandani
Ranch Hand
Posts: 274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out,

Shift and Bitwise operators are used to manipulate data at bit level.

Shift operatorsBitwise operators
>>&
<<^
>>>|
~

Shift operators should be used only with operands of type int or long, though they can also be used with other integral types. Shift operators always return a result of type INT or LONG.

Positive integer0..0 110012
Negative integer1..1 1100-4

Negative integer1..1 1100-4
Signed right-shift1..1 1110-2
unsigned right-shift0..1 11102147483646
Left-shift1..1 1000-8

With the unsigned right-shift operator (>>> and the left shift operator, the new bits are always set to 0.

The result of ~x will always be the value ((-x) -1)

Hope it helps.

grrr
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "grr rrr"-

Welcome to JavaRanch.

On your way in you may have missed that we have a JavaRanch Naming Policy for displayed (screen) names. Your displayed name must consist of a first name (or an initial), a space, and a family name (in that order) and not be obviously fictitious. Since yours "grr rrr", does not conform with it, please take a moment to change it, which you can do right here.

Posters with nonconforming displayed names will be locked out of JavaRanch after a few posts using those names.

Thanks
-Barry

(NR) - search tag
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic