Occurences of pattern

https://www.geeksforgeeks.org/occurrences-of-a-pattern-in-binary-representation-of-a-number/

Can anyone explain how the above condition works in while loop:

why the while loop is run until (n&n <=pattern_int)?