code: public static double BrayCurtis(double[] p, double[] q) {
          double sumP, sumN;
          sumP = sumN = 0;
  
          for (int i = 0; i < p.length; i++) {
              sumN += Math.abs(p[i] - q[i]);
              sumP += Math.abs(p[i] + q[i]);
          }
  
          return sumN / sumP;
      }
docs: Gets the Bray Curtis distance between two points.
  
  @param p A point in space.
  @param q A point in space.
  @return The Bray Curtis distance between x and y.