Use the modulus(%) operator modulus(%) : -
if (i % 5 == 0) { }
5 % 5 == 0 , 10 % 5 == 0 , ...
Since you are using for loop , you can simply change your increment from i++ to i += 5 and leave the if condition.
for (int i = 0; i < someNum; i += 5) { // No need to check for `i` against `modulus 5`. }
source share