[C++/Java] Decimal to Binary & Count
Explanation:\n1. Convert the decimal number to binary array form\n2. Count the number of odd bits and even bits as per the given condition\n\n## Code:\nJava []\
## Explanation:\n1. Convert the decimal number to binary array form\n2. Count the number of odd bits and even bits as per the given condition\n\n## Code:\n```Java []\nclass Solution {\n    public int[] evenOddBit(int n) {\n        int[] res=new int[2];\n        String num=Integer.toBinaryString(n);\n        int odd=0,even=0;\n        for(int i=num.length()-1,k=0;i>=0;i--,k++){\n            if(num.charAt(i)==\'1\'){\n                if(k%2==0) res[0]++;\n                else res[1]++;\n            }\n        }\n        return res;\n    }\n}\n\n```\n```C++ []\nclass Solution {\npublic:\n    vector<int> evenOddBit(int n) {\n        vector<int>arr;\n        int i=0;\n        while(n!= 0){\n            arr.push_back(n%2);\n            i++,n/=2;\n        } \n        int even=0,odd=0;\n        for(int i=0;i<arr.size();i++){\n            if(arr[i] && (i)%2) odd++;\n            else if(arr[i]) even++;\n        }\n        return {even,odd};\n    }\n};\n```\n\n## Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n
['Array', 'Counting', 'C++', 'Java']