comefrom: <awangdev>Cosine Similarity_1.java
code: public double cosineSimilarity(int[] A, int[] B) {
      	if (A == null || B == null || A.length == 0 || B.length == 0 || A.length != B.length) {
      		return 2;
      	}
  
      	double sumProduct = 0;
      	double sumASq = 0;
      	double sumBSq = 0;
      	for (int i = 0; i < A.length; i++) {
      		sumProduct += A[i]*B[i];
      		sumASq += A[i] * A[i];
      		sumBSq += B[i] * B[i];
      	}
      	if (sumASq == 0 && sumBSq == 0) {
      		return 2.0;
      	}
      	return sumProduct / (Math.sqrt(sumASq) * Math.sqrt(sumBSq));
      }
masked: public double sample_funcname ( int [ ] var_0 , int [ ] var_1 ) {
    if ( var_0 == null || var_1 == null || var_0 . length == 0 || var_1 . length == 0 || var_0 . length != var_1 . length ) {
      return 2 ;
    }
    double var_2 = 0 ;
    double var_3 = 0 ;
    double var_4 = 0 ;
    for ( int var_5 = 0 ;
    var_5 < var_0 . length ;
    var_5 ++ ) {
      var_2 += var_0 [ var_5 ] * var_1 [ var_5 ] ;
      var_3 += var_0 [ var_5 ] * var_0 [ var_5 ] ;
      var_4 += var_1 [ var_5 ] * var_1 [ var_5 ] ;
    }
    if ( var_3 == 0 && var_4 == 0 ) {
      return 2.0 ;
    }
    return var_2 / ( Math . sqrt ( var_3 ) * Math . sqrt ( var_4 ) ) ;
  }
  