✅ Simple Java Solution
CODE\nJava []\npublic int smallestNumber(int n) {\n\tString str = Integer.toBinaryString(n);\n\tint i=str.length()-1, res = 0;\n\n\twhile(i >= 0) {\n\t\tres += 
## **CODE**\n```Java []\npublic int smallestNumber(int n) {\n\tString str = Integer.toBinaryString(n);\n\tint i=str.length()-1, res = 0;\n\n\twhile(i >= 0) {\n\t\tres += (1<<i);\n\t\ti--;\n\t}\n\treturn res;\n}\n```
['Java']