Java One-Liner
This problem can be done by performing a bitwise AND operation of the input integer n with two binary masks: 0x55555555 and 0xAAAAAAAA.\n- The binary mask 0x555
- This problem can be done by performing a bitwise AND operation of the input integer n with two binary masks: 0x55555555 and 0xAAAAAAAA.\n- The binary mask 0x55555555 has alternate bits set to 1 starting from the least significant bit. Therefore, performing a bitwise AND operation of n with this mask extracts the set bits at even positions.\n- The binary mask 0xAAAAAAAA has alternate bits set to 1 starting from the second least significant bit. Therefore, performing a bitwise AND operation of n with this mask extracts the set bits at odd positions.\n- The number of set bits in the resulting binary representations are counted using the Integer.bitCount method, and the results are returned as an integer array containing the count of even and odd bits, respectively.\n```\nclass Solution {\npublic int[] evenOddBit(int n) {\n    return new int[] {Integer.bitCount(n & 0x55555555), Integer.bitCount(n & 0xAAAAAAAA)};\n}\n}\n```\n# Do UpVote If You Liked the Solution
['Java']