2595. Number of Even and Odd Bits 🧑‍💻🧑‍💻 || 100% Easy java code 💁💁...
Code\n\nclass Solution {\n    public int[] evenOddBit(int n) {\n        String str1 = Integer.toBinaryString(n);\n\t\t\t\tStringBuffer sc = new StringBuffer(str
# Code\n```\nclass Solution {\n    public int[] evenOddBit(int n) {\n        String str1 = Integer.toBinaryString(n);\n\t\t\t\tStringBuffer sc = new StringBuffer(str1);\n\t\t\t\tsc.reverse();\n\t\t\t\tString str =sc.toString();\n\t    \n\t    int Even_count = 0;\n\t    int Odd_count = 0;\n\t    int[] arr = new int[2];\n\t    \n\t    for(int i=0 ; i<str.length();i++){\n\t        if((str.charAt(i) == \'1\') && i%2==0){\n\t            Even_count++;\n\t        }\n\t        else if(str.charAt(i) == \'1\'){\n\t            Odd_count++;\n\t        }\n\t    }\n\t    \n\t    arr[0] = Even_count;\n\t    arr[1] = Odd_count;\n\t    \n\t    return arr;\n    }\n}\n```
['Java']