take the integers as the maximum value of integer hoping the integer would not be present in the array
static void findMajority ( int arr [ ] , int n ) { int count1 = 0 , count2 = 0 ; int flag = 0 ; int first = Integer . MIN_VALUE ; ; int second = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) {