Largest set with bitwise OR equal to n | Java Program to find the largest set with bitwise OR equal to n ; function to find the largest set with bitwise OR equal to n ; If the bitwise OR of n and i is equal to n , then include i in the set ; Driver Code
import java . util . * ; class GFG { static void setBitwiseORk ( int n ) { Vector < Integer > v = new Vector < Integer > ( ) ; for ( int i = 0 ; i <= n ; i ++ ) { if ( ( i n ) == n ) { v . add ( i ) ; } } for ( int i = 0 ; i < v . size ( ) ; i ++ ) { System . out . print ( v . get ( i ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 5 ; setBitwiseORk ( n ) ; } }