1. Home
  2. Computing & Technology
  3. Java
Paul Leahy
Paul's Java Blog

By Paul Leahy, About.com Guide to Java

Java Term of the Week: Bitwise Operator

Saturday May 16, 2009

Bitwise operators perform operations on the bits of their operands. The operands can only be byte, short, int, long or char data types. For example, if an operand is the number 48, the bitwise operator will perform its operation on the binary representation of 48 (i.e., 110000).

There are three binary logical operators:

&performs a logical AND operation.
^performs a logical OR operation.
|performs a logical XOR operation.

There are three bit shift operators:

>>the signed left shift operator shifts the bits of a binary number to the left.
<<the signed right shift operator shifts the bits of a binary number to the right.
>>>the unsigned right shift operator shifts the bits of a binary number to the right, filling the left most bit with a zero.

And finally the unary operator:

~the bitwise complement operator inverts the bits of a binary number.

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Java
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java

©2009 About.com, a part of The New York Times Company.

All rights reserved.