✔ Java || Simple || Using log() function
\nclass Solution {\n    public int concatenatedBinary(int n) {\n        long result=1;\n        int length=0;\n        for(int i=2;i<=n;i++) {\n            // l
```\nclass Solution {\n    public int concatenatedBinary(int n) {\n        long result=1;\n        int length=0;\n        for(int i=2;i<=n;i++) {\n            // length of number in binary form\n            length=((int)(Math.log(i)/Math.log(2)))+1;\n            result=((result<<length)+i)%1000000007;\n        }\n        return (int)result;\n    }\n}\n```
['Java']