Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rewording

...

Left- and right-shift operators are often employed to multiply or divide a number by a power of 2. However, using shift operators to represent multiplication or division is an optimization that renders the code less portable and less readable. FurthermoreThis compromises code readability and portability for the sake of often-illusory speed gains. The JVM will usually make such optimizations automatically, and unlike a programmer, the JVM can optimize multiplications and divisions by constant powers of 2 with bit-shift operations, and they are more familiar with for the implementation details of the current platform.

...

Code Block
bgColor#ccccff
int x = -50;
x += 2
x /= 4;

...

Exceptions

INT03-EX1: Bitwise operations may be used to construct constant expressions.

...