Why is Netbeans suggesting I “Flip operands of the binary operators” in my Java code

Netbeans frequently suggests that I “flip operands of the binary operator” when I’m doing mathematical calculations. For example, in the following line of code:

    change = 100 - price;

    quarters = change / 25;
    dimes = change % 25 / 10;
    nickels = change % 25 % 10 / 5;
    pennies = change % 25 % 10 % 5;

Netbeans makes the suggestion for every mathematical symbol (so it does it three times in the ‘pennies’ line.

I’m not sure I understand why it’s making the suggestion. If I were to flip the operands while performing division I would get a different result (if “flip” means what I think it does, which is switch the order of the two values). Why does it suggest this?

Leave a Comment