Minimum value among AND of elements of every subset of an array | Java program for the above approach ; Find AND of whole array ; Print the answer ; Driver code
class GFG { static void minAND ( int [ ] arr , int n ) { int s = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { s = s & arr [ i ] ; } System . out . println ( s ) ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 } ; int n = arr . length ; minAND ( arr , n ) ; } }