Quadruplet pair with XOR zero in the given Array | Java implementation of the approach ; Driver code
import java . util . HashMap ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; public class QuadrapuleXor { static boolean check ( int arr [ ] ) { int n = arr . length ; if ( n < 4 ) return false ; if ( n >= 130 ) return true ; Map < Integer , List < Integer > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { int k = arr [ i ] ^ arr [ j ] ; if ( ! map . containsKey ( k ) ) map . put ( k , new LinkedList < > ( ) ) ; List < Integer > data = map . get ( k ) ; if ( ! data . contains ( i ) && ! data . contains ( j ) ) { data . add ( i ) ; data . add ( j ) ; if ( data . size ( ) >= 4 ) return true ; map . put ( k , data ) ; } } } return false ; } public static void main ( String [ ] args ) throws java . lang . Exception { int arr [ ] = { 1 , 0 , 2 , 3 , 7 } ; if ( check ( arr ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }