Easy Java Solution ||  Beats 100% ||
\n\n# Code\njava []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int []output=new int[nums.size()];\n       for(int i=0;i<
\n\n# Code\n```java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int []output=new int[nums.size()];\n       for(int i=0;i<nums.size();i++){\n           int num=nums.get(i);\n        int sum=-1;\n        int a=0;\n        while(a<num){\n        if((a | a+1)==nums.get(i)){\n            sum=a;\n            break;\n        }\n        a++;\n        }\n        output[i]=sum;\n       } \n       return output;\n    }\n}\n```\n![upvote.jpeg](https://assets.leetcode.com/users/images/fa27f64a-0c9f-46d0-b226-2e85c6741f87_1728748888.6988442.jpeg)
['Bit Manipulation', 'Java']