3370 solution in java
ApproachUse the property of (&) operator which return 1 if both value is one.
So for num with setbits num &(num+1) will be 0

explanation:

       7 --> 111


# Approach
   Use the property of (&) operator which return 1 if both value is one.
>  So for num with setbits num &(num+1) will be 0
>>    explanation:
>>>            7 --> 111
>>>            8 --> 1000
>>>        7 & 8 --> 0



# Code
```java []
class Solution {
    public int smallestNumber(int n) {
        int num = n; // Start with n
        
        while (true) { // Loop until we find the valid number
            int temp = num; // Temporary variable to check binary digits
            boolean allSet = true; // Flag to check if all bits are set
            
            // Check each bit of the number
            while (temp > 0) {
                int rem = temp % 2; // Extract the least significant bit
                if (rem == 0) { // If any bit is 0, it's not valid
                    allSet = false;
                    break;
                }
                temp /= 2; // Move to the next bit
            }
            
            if (allSet) { // If all bits are set, return the number
                return num;
            }
            
            num++; // Increment the number and check again
        }
    }
}

```
['Math', 'Bit Manipulation', 'Java']