[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Looking for Long Tooth...
I am a little surprised by this question and the other one like it a few
weeks ago. I have a sneaky feeling that I am helping a college student do
his homework, but I'll respond anyway.
There are infinitely many ways these operators can be useful.. But I'll just
give a few examples:
* Data Compression - Many data compression algorithms compress byte streams
into bit streams. To create (and later decode) the bit streams, you need
bitwise operators.
* Non-Java Binary File I/O - When working with binary files that were
created in C, C++, etc. you will see a lot of use of things like unsigned
16, and 32 bit values. Since Java doesn't support these, you have to use
bitwise operators to put the uint16 into a Java int32. And vise versa.
* Old file formats - Like the previous example. A long time ago, (when
dinosaurs still roamed the earth and when I was in high-school) people did
not have much disk space. So file formats made HEAVY use of bit fields to
store a series of boolean flags. To read or write these flags use need -
bitwise operators.
* Arbitrarily Precision Integer Math - Math packages that implement 64, 128,
256 bit integers, etc. These packages use bitwise operators (at least I
think they do).
* Hardware Simulation - Hardware adders multipliers etc. are sometimes
simulated in software using bitwise operations. Not common, but I did this
back in School.
Scott Smith
----- Original Message -----
From: "Lee Chalupa" <lchalupa@seelink.org>
To: "Atlanta Java Users Group" <ajug-members@ajug.org>
Sent: Wednesday, April 09, 2003 9:24 AM
Subject: Looking for Long Tooth...
> Hello:
>
> I would like to find some examples of business problems that are addressed
> using
> bitwise operators or shift operators.
>
> I think one of the reasons people have trouble with these two topics is
> that they
> seem irrelevant to their work.
>
> My guess is that some of our more experienced programmers used these
> operators in the "good old days".
>
> Does anybody have some practical examples of where they put these
operators
> to good use?
>
> Thanks
>
> Lee Chalupa
> AJUG Certification Group
>
>