Iterating over both the arrays and count the number of occurrences of '0'
for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) == '0' ) { Count1 ++ ; } if ( s2 . charAt ( i ) == '0' ) { Count2 ++ ; }