Changed processes count checking logic

Important: java has very poor performance with many if-else statements
I've changed this code because it was a problem. For example:
i = 100001 then if we divide it to 20 i = 5000 (> 1000) - not good;