How can I check wether an integer is even or not?
if ( value % 2 == 0 ) // executes when 'value' is even if ( value % 2 == 1) // executes when 'value' is odd
int value = Greenfoot.getRandomNumber(100); int remainder = value % 2; // is equivalent to int value = Greenfoot.getRandomNumber(100); int remainder = value - (value/2)*2;