Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one and division by one. Such expressions may be the result of automated refactorings not completely followed through to completion, and in any case are unlikely to be what the developer intended to do.

Example:

  int x = a - a; // redundant; can be replaced with 0
  int y = a + 0; // redundant; can be replaced with a
  double res = d / d; // redundant; can be replaced with 1.0

Note that in rare cases, the suggested replacement might not be completely equivalent of the original code for all possible inputs. E.g. the inspection suggests to replace x / x with 1. However, if x happens to be zero, the original code throws ArithmeticException or results in NaN. Also, if x is NaN, then the result is also NaN. It's very unlikely that such a behavior is intended.