✅ Java Solution
CODE\nJava []\npublic int minChanges(int n, int k) {\n\tString bn = Integer.toBinaryString(n);\n\tString bk = Integer.toBinaryString(k);\n\n\tif(bn.length() < b
## **CODE**\n```Java []\npublic int minChanges(int n, int k) {\n\tString bn = Integer.toBinaryString(n);\n\tString bk = Integer.toBinaryString(k);\n\n\tif(bn.length() < bk.length()) {\n\t\treturn -1;\n\t}\n\tint i = bn.length()-1, j = bk.length()-1, ct = 0;\n\twhile(i>=0 && j>=0) {\n\t\tchar ch1 =bn.charAt(i--), ch2 = bk.charAt(j--);\n\t\tif(ch1 != ch2) {\n\t\t\tif(ch1 == \'1\') ct++;\n\t\t\telse return -1;\n\t\t}\n\t}\n\n\twhile(i>=0) ct+=(bn.charAt(i--)==\'1\'? 1: 0);\n\n\treturn ct;\n}\n```
['Java']