|
-
Oct 31st, 2001, 12:09 AM
#1
Thread Starter
Hyperactive Member
Using Bitwise shifts
This was going to be a question, but then I figured it out, but I thought that someone else might benefit, hence this post.
The operators <<, >>, and >>> shifts the bits in primitive datatypes.
The number following the operator specifies the number of places to shift.
EG:
Code:
int num = 2; // 0000 0010
num = num << 2; // 0000 1000 == 8
The >> shifts the bits right, EXCEPT for the sign bit, the >>> operator shifts the signbit also.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|