code: public static double linSimilarity(int[] a, int[] b) {
          check(a, b);
  
          // The total amount of information contained in a.
          double aInformation = 0;
          // The total amount of information contained in b.
          double bInformation = 0;
          // The total amount of information contained in both vectors.
          double combinedInformation = 0;
  
          // Compute the information between the two vectors by iterating over
          // all known values.
          for (int i = 0; i < a.length; ++i) {
              aInformation += a[i];
              bInformation += b[i];
              if (a[i] != 0d && b[i] != 0d)
                  combinedInformation += a[i] + b[i];
          }
          return combinedInformation / (aInformation + bInformation);
      }
docs: Computes the lin similarity measure, which is motivated by information
  theory priniciples.  This works best if both vectors have already been
  weighted using point-wise mutual information.  This similarity measure is
  described in more detail in the following paper:
  
  <li style="font-family:Garamond, Georgia, serif">D. Lin, "Automatic
  Retrieval and Clustering of Similar Words" <i> Proceedings of the 36th
  Annual Meeting of the Association for Computational Linguistics and
  17th International Conference on Computational Linguistics, Volume 2
  </i>, Montreal, Quebec, Canada, 1998.
  </li>
  
  @throws IllegalArgumentException when the length of the two vectors are
  not the same.