Find all Pairs possible from the given Array | Java implementation to find all Pairs possible from the given Array ; Function to print all possible pairs from the array ; Nested loop for all possible pairs ; Driver code
class GFG { static void printPairs ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( " ( " + arr [ i ] + " , ▁ " + arr [ j ] + " ) " + " , ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 } ; int n = arr . length ; printPairs ( arr , n ) ; } }