public static double P(double Y[][],int j,int v,int k,int w){
  int N=Y.length;
  double p=0.0001;
  for (int i=0; i < N; i++) {
    if (((int)Math.round(Y[i][j]) == v) && ((int)Math.round(Y[i][k]) == w))     p+=1.0;
  }
  return p / N;
}

public static double P ( double Y [ ] [ ] , int j , int v , int k , int w ) { int N = Y . length ; double p = 0.0001 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( ( int ) Math . round ( Y [ i ] [ j ] ) == v ) && ( ( int ) Math . round ( Y [ i ] [ k ] ) == w ) ) p += 1.0 ; } return p / N ; }
p - empirical joint . multi - target friendly .
