code: public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
          Set<String> common = new TreeSet<String>(features1.keySet());
          common.retainAll(features2.keySet());
          double xy = 0., x = 0., y = 0.;
          for (String s : common) {
              int c1 = features1.get(s), c2 = features2.get(s);
              xy += c1 * c2;
          }
          for (Integer c : features1.values()) {
              x += c * c;
          }
          for (Integer c : features2.values()) {
              y += c * c;
          }
          return (float) (xy / (x + y - xy));
      }
docs: Evaluate continuous Tanimoto coefficient for two feature, count fingerprint representations.
  <p>
  Note that feature/count type fingerprints may be of different length.
  
  Uses Tanimoto method from 10.1021/ci800326z
  
  @param features1 The first feature map
  @param features2 The second feature map
  @return The Tanimoto coefficient