Welcome to the Ranch
Afraid there is more you can do to improve that method. Going back to the old
old Sun Style Guide, we see it says not to write
if (something) return true; else return false; So we can reduce your method to this:-
Note that I haven't removed the redundant () and I haven't corrected any errors.
There is a quicker way to do that
That may look too scary for the beginning forum, but it tests whether the last bit is 1 or 0. You can get that sort of thing to work for powers of 2: 1, 2, 4, 8, 16,
etc., but not other numbers. You can also shorten your second code block:-