docs: public static double ChiSquare(double[] histogram1, double[] histogram2) {
          double r = 0;
          for (int i = 0; i < histogram1.length; i++) {
              double t = histogram1[i] + histogram2[i];
              if (t != 0)
                  r += Math.pow(histogram1[i] - histogram2[i], 2) / t;
          }
  
          return 0.5 * r;
      }