public Double[] findKthPoint(Double[][] knn, Double[] x, int length) {
    int index;
    Double[][] d = new Double[length][2];
    for (int i = 0; i < length; i++) {
      d[i][0] = (double) i;
      d[i][1] = dist(knn[i], x);
    }
    index = (int) (double) (findKthNum(d, 0, length - 1, multipleK + 1));
    return knn[index];
  }
This function is used to detect density anomaly of time series.
library-udf/src/main/java/org/apache/iotdb/library/anomaly/UDTFLOF.java