Using Long && Easy Logic without  need of Explanation
\nclass Solution {\n\tpublic int concatenatedBinary(int n) {\n\t\tlong res = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tres = (res * (int) Math.pow(2, Intege
```\nclass Solution {\n\tpublic int concatenatedBinary(int n) {\n\t\tlong res = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tres = (res * (int) Math.pow(2, Integer.toBinaryString(i).length()) + i) % 1000000007;\n\t\t}\n\t\treturn (int) res;\n\t}\n}\n```
['Java']