Check for each divisor i . e . arr [ i ] % b = k or not , if yes then print that pair .
for ( int j = 0 ; j < v . size ( ) ; j ++ ) { if ( arr [ i ] % v . get ( j ) == k && arr [ i ] != v . get ( j ) && occ . get ( v . get ( j ) ) ) { System . out . print ( " ( " + arr [ i ] + " , ▁ " + v . get ( j ) + " ) ▁ " ) ; isPairFound = true ; } }