public final double similarity(final boolean[] sig1,final boolean[] sig2){
  double agg=0;
  for (int i=0; i < sig1.length; i++) {
    if (sig1[i] == sig2[i]) {
      agg++;
    }
  }
  agg=agg / sig1.length;
  return Math.cos((1 - agg) * Math.PI);
}

public final double similarity ( final boolean [ ] sig1 , final boolean [ ] sig2 ) { double agg = 0 ; for ( int i = 0 ; i < sig1 . length ; i ++ ) { if ( sig1 [ i ] == sig2 [ i ] ) { agg ++ ; } } agg = agg / sig1 . length ; return Math . cos ( ( 1 - agg ) * Math . PI ) ; }
compute the similarity between two signature , which is also an estimation of the cosine similarity between the two vectors .
