Smallest_number_with_all_set_bits  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
  8 --

# 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
```java []
class Solution {
    public int smallestNumber(int n) {
        int num=n;
        while((num & (num+1)) != 0)
        {
            num++;
        }
        return num;
    }
    
}
```
['Java']