Prints union of arr1 [ 0. . n1 - 1 ] and arr2 [ 0. . n2 - 1 ]
private void printUnion ( int v , int [ ] ans , int zero ) { int zero1 = 0 ; System . out . print ( " Union : "); for ( int i = 0 ; i < v ; i ++ ) { if ( ( zero == 0 && ans [ i ] == 0 ) || ( ans [ i ] == 0 && zero1 > 0 ) ) continue ; if ( ans [ i ] == 0 ) zero1 ++ ; System . out . print ( ans [ i ] + " , " ) ; } }