### Betlista's blog

By Betlista, 7 years ago,

I failed in contest #280 because of int overflow.

I knew I have to handle that, but I missed it :-( So I was looking for some automatic check. My Java IDE is Eclipse, so this tutorial is for Eclipse...

Current Eclipse version I'm using is Luna (4.4.1), may be different, but similar in other newer/older versions...

1. From Eclipse Marketplace (Help > Eclipse Marketplace...) install FindBugs (search for "findbugs", current version of FindBugs plugin is 3.0.0)
2. when installed and Eclipse is restarted, from Window > Preferences in FindBugs preferences set minimum rank to max — 20 and confidence to min — low

1. As a last thing you have to set up from project properties (again FindBugs properties), that scanning is running automatically

The result is then similar to:

The problem was, that I had count and cost as ints

Opened questions:

It works for me for a code above, but for this code it is not working, I have no idea why it is different...

	final int mil1 = 1000000;
final int mil2 = 1000000;
long res2 = mil1 * mil2;


Related SO questions, that lead me to a solution:

• +15