How can I check if something is an even number?
I need to make something so that if int x is even then boolean y will be true. But I cannot find how to see if something is even? I tried something likeif (x / 2 ==int)
lol but that does not work. So what is the statement?
[304 byte] By [
punchouta] at [2007-10-1 0:52:22]

> > n % powerOf2 == n & (powerOf2 - 1);> > I'm sorry, that tests for even-ness?no, it is a statement by itself (i.e. n & powerOf2 is equiv to n & (powerOf2 - 1))
> alright thanks guys
>
> I forgot about the % just because we never used it in
> 'real' math class so I never remember it.
I much prefer imaginary math. Even still, I wish they would allow the mod operator in class and put in on calculators, it can really help sometimes...