4 comments

[ 2.9 ms ] story [ 16.7 ms ] thread
Are problems like these actually asked during job interviews?

I don't mean that this isn't a good topic, just that I always imagined that interview questions would be harder to solve and that they wouldn't ask for contrived solutions (solutions that aren't obvious and could lead to bugs for new coders, while not being better in many other ways).

Hi Ryankey721, yes, it does get asked. Interviews are funny, some time you get theoretical non relevant question, some time easy one like this, and very rarely relevant coding exercise.
Dear ${DEITY}, this makes all java programmers look bad. Really all it should say is

public static boolean isOdd(int i) { return i & 1 == 1; }

This looks really nice, better than isEven() version.

public static boolean isOdd(int i) { return i & 1 == 1; }