code: public static double method1(ICountFingerprint fp1, ICountFingerprint fp2) {
          long xy = 0, x = 0, y = 0;
          for (int i = 0; i < fp1.numOfPopulatedbins(); i++) {
              int hash = fp1.getHash(i);
              for (int j = 0; j < fp2.numOfPopulatedbins(); j++) {
                  if (hash == fp2.getHash(j)) {
                      xy += fp1.getCount(i) * fp2.getCount(j);
                  }
              }
              x += fp1.getCount(i) * fp1.getCount(i);
          }
          for (int j = 0; j < fp2.numOfPopulatedbins(); j++) {
              y += fp2.getCount(j) * fp2.getCount(j);
          }
          return ((double) xy / (x + y - xy));
      }
docs: Calculates Tanimoto distance for two count fingerprints using method 1.
  
  The feature/count type fingerprints may be of different length.
  Uses Tanimoto method from {@cdk.cite Steffen09}.
  
  @param fp1 count fingerprint 1
  @param fp2 count fingerprint 2
  @return a Tanimoto distance