Arithmetic & Logic

See my lecture on Java Basics for an overview of Java operations.

Also see my lecture on Boolean Algebra.

See OperatorDemo.java for shifts and bitwise operations.

Info on all Java operators can be found at:

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html

 

Boolean Operations

a && b

a || b

!a

Bitwise Operations

a & b

a | b

~a

a ^ b

Shifts

a << b (0 fill)

a >> b (sign fill)

a >>> b (0 fill)

Arithmetic Operations

a + b

a – b

a * b

a + b

a % b

a / b