Possible Duplicates:
Is shifting bits faster than multiplying and dividing in Java? .NET?
Quick Java Optimization Question
Many years ago in college, I learned that bit-shifting right by one accomplishes the same thing as dividing by two, but is generally significantly faster. I'm not sure how Java has come along in that regards since the 9-10 years ago I learned about that. Does the Java compiler automatically converts a divide-by-two into a bit-shift operation, or should I manually perform the bit-shift operation in the code myself?
Unless you're working in a shop and a codebase where bit-shifting is common then, IMHO, you're risking obfuscation. Yes, the expressions may be logically equivalent but:
All this is relative and, again, really depends on your shop's standards. If your colleagues love to bit-shift, then by all means go forth and bit-shift.