[java] solution
\nclass Solution {\n    public int concatenatedBinary(int n) {\n        \n        int mod = 1000000007;\n        int num = 0;\n        \n        for(int i=1;i<=
```\nclass Solution {\n    public int concatenatedBinary(int n) {\n        \n        int mod = 1000000007;\n        int num = 0;\n        \n        for(int i=1;i<=n;i++)\n        {\n            String binaryRep = Integer.toBinaryString(i);\n            \n            for(char ch:binaryRep.toCharArray())\n            {\n                int val = (ch==\'0\')?0:1;\n                \n                num = ((num*2)%mod + val)%mod;\n            }\n        }\n        return num;\n    }\n}\n```
[]