Java | Time 100% | Space 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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(), index = 0;\n\t\tint[] res = new int[n];\n\t\tfor (int num : nums) {\n\t\t\tif (num % 2 != 0) {\n\t\t\t\tint ans = -1, max = (int) (Math.log(num) / Math.log(2));\n\t\t\t\tfor (int i = max; i >= 0; i--) {\n\t\t\t\t\tint newN = num - (1 << i);\n\t\t\t\t\tif ((newN | (newN + 1)) == num) {\n\t\t\t\t\t\tans = newN;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tres[index++] = ans;\n\t\t\t} else\n\t\t\t\tres[index++] = -1;\n\t\t}\n\t\treturn res;\n    }\n}\n```
['Math', 'Java']