Count pairs with Bitwise AND as ODD number | Java program to count pairs with Odd AND ; Count total odd numbers in ; return count of even pair ; Driver Code ; calling function findOddPair and print number of odd pair
class solution_1 { static int findOddPair ( int A [ ] , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) if ( ( A [ i ] % 2 == 1 ) ) count ++ ; return count * ( count - 1 ) / 2 ; } public static void main ( String args [ ] ) { int a [ ] = { 5 , 1 , 3 , 2 } ; int n = a . length ; System . out . println ( findOddPair ( a , n ) ) ; } }