Detailed explained simple java solution faster than 100%
Time Complexity : O(n) \nSpace Complexity : O(1) \n\nIf you like hit the like button. Otherwise comment down for clarification.\n\n# Code\n\nclass Solution {\n 
**Time Complexity : O(n)** \n**Space Complexity : O(1)** \n\n**If you like hit the like button. Otherwise comment down for clarification.**\n\n# Code\n```\nclass Solution {\n    public int[] evenOddBit(int n) {\n        // First convert integer to a string\n        String bString = Integer.toBinaryString(n);\n\n        // Then reverse it because in numbers we count\n        // indexes from right to left but in string we\n        // count indexes from left to right.\n        // we use StringBuilder to reverse the string.\n         StringBuilder sb=new StringBuilder(bString);\n        sb.reverse();\n\n        // Now convert the StringBuilder to a string\n        String s = sb.toString();\n        // Now count the number of odd and even bits presents in the string\n        int odd=0,even=0;\n        for(int i=0;i<s.length();i++)\n        {\n            if(s.charAt(i)==\'1\')\n            {\n                if(i%2==0) even++;\n                else\n                    odd++;\n            }\n        }\n        // Now store even and odds in an array and return that array.\n        int a[] = new int[2];\n        a[0]=even;\n        a[1]=odd;\n        return a;\n    }\n}\n```
['Array', 'String', 'Java']