Java Clean Simple Solution | using BitManipulation
Complexity\n- Time complexity:O(n*32)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n)\n Add your space complexity here, e.g. O(n) \n\n# C
# Complexity\n- Time complexity:$$O(n*32)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int n = nums.size();\n        \n        int[] ans = new int[n];\n        for (int i = 0; i < n; i++) {\n            int num = nums.get(i);\n            \n            int minimalAns = Integer.MAX_VALUE;\n            boolean flag = false;\n            for (int bit = 0; bit < 31; bit++) {\n                if (((num >> bit) & 1) == 1) {\n                    int bit_ = num & ~(1 << bit);\n                    if (bit_ < 0) {\n                        continue;\n                    }\n\n                    if ((bit_ | (bit_ + 1)) == num) {\n                        if (bit_ < minimalAns) {\n                            minimalAns = bit_;\n                            flag = true;\n                        }\n                    }\n                }\n            }\n\n            if (flag) {\n                ans[i] = minimalAns;\n            } else {\n                ans[i] = -1;\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Math', 'Bit Manipulation', 'Bitmask', 'Java']