Skip to content

Commit

Permalink
improving even check utility
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Jan 10, 2025
1 parent 46ddc83 commit 45d5941
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static boolean isPowerOfTwo(final int toCheck) {
* @return {@code true} if the given number is even
*/
public static boolean isEven(final int toCheck) {
return (toCheck % 2) == 0;
return (toCheck & 1) == 0;
}

private MathUtilities() {}
Expand Down

0 comments on commit 45d5941

Please sign in to comment.