0ms | Java Solution | Bit Manipulation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public boolean check(int n, int i){\n        return ((n>>i) & 1) == 1 ;\n    }\n    public int minChanges(int n, int k) {\n        int c=0;\n        for(int i=0;i<31;i++){\n            if(check(n,i)==check(k,i)){}\n            else if(check(n,i) & !check(k,i)) c++;\n            else return -1;\n        }\n        return c;\n    }\n}\n```
['Java']