Java
\n\n# Code\njava []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n\n\t\t\n\t\tint count=0;\n\t\tint ans[]= new int[nums.size()];\n\
\n\n# Code\n```java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n\n\t\t\n\t\tint count=0;\n\t\tint ans[]= new int[nums.size()];\n\t\tfor (int i = 0; i<=nums.size()-1; i++) {\n\t\t\t\n\t\t\tfor (int j = 0; j<=nums.get(i); j++) {\n\t\t\t\t\n\t\t\t\tif((j | (j + 1)) == nums.get(i))\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tans[i]=j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count==0)\n\t\t\t{\n\t\t\t\tans[i]=-1;\n\t\t\t}\n\t\t\tcount=0;\n\t\t}\n        return ans;\n    }\n}\n```
['Java']