File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Bit wise and shift operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Bit wise and shift operators" Watch "Bit wise and shift operators" New topic

Bit wise and shift operators

Argm Mastoi
Ranch Hand

Joined: Oct 16, 2001
Posts: 35
Hi guys,
i learned the mechanism of Shift operators and bitwise operators but i couldn't understand that for what purpose they're used. can any one please explain. thanx in advance.
David Eason

Joined: Oct 31, 2001
Posts: 14
Sorry I couldn't think of a better example for the & operator. Basically, it is used to extract individual bits from a numeric type.

As for the shift operators, in other programming languages one use for them is fast multiplication and division by powers of 2. I am not sure if that particular optimization is necessary in Java, because I am not that familiar with Java.

[This message has been edited by David Eason (edited November 06, 2001).]
Jag Sharma

Joined: Nov 09, 2001
Posts: 10
I believe that bit patterns are also used in Computer Graphics, Animations.
Argm Mastoi
Ranch Hand

Joined: Oct 16, 2001
Posts: 35
Thanx Jagdeep, now i got an idea about the usage of these from your answer. I was looking forward for Cindy's answer as her answers make the situation crystal clear.
Consider Paul's rocket mass heater.
subject: Bit wise and shift operators
It's not a secret anymore!