code: public static double fBeta(double beta, double precision, double recall) {
          if (precision == 0.0 || recall == 0.0)
              return 0;
  
          double numerator = (1 + beta * beta) * precision * recall;
          double denominator = beta * beta * precision + recall;
  
          return numerator / denominator;
      }
docs: Calculate the F-beta value from precision and recall
  
  @param beta      Beta value to use
  @param precision Precision
  @param recall    Recall
  @return F-beta value