Print bitwise AND set of a number N | JAVA program to print all bitwise subsets of N ( Naive approach ) ; function to find bitwise subsets Naive approach ; Driver function
class GFG { static void printSubsets ( int n ) { for ( int i = 0 ; i <= n ; i ++ ) if ( ( n & i ) == i ) System . out . print ( i + " ▁ " ) ; } public static void main ( String [ ] args ) { int n = 9 ; printSubsets ( n ) ; } }