docs: private TreeNode split(TreeNode node, ClusteringFeature newchild) {
      final int capacity = node.children.length;
      assert (node.children[capacity - 1] != null) : "Node to split is not empty!";
      TreeNode newn = new TreeNode(node.getDimensionality(), capacity);
      final int size = capacity + 1;
      // Find farthest pair:
      int m1 = -1, m2 = -1;
      double maxd = Double.NEGATIVE_INFINITY;
      double[][] dists = new double[size][size];
      for(int i = 0; i < capacity; i++) {
        ClusteringFeature ci = node.children[i];
        for(int j = i + 1; j < capacity; j++) {
          double d = dists[i][j] = dists[j][i] = distance.squaredDistance(ci, node.children[j]);
          if(d > maxd) {
            maxd = d;
            m1 = i;
            m2 = j;
          }
        }
        double d = dists[i][capacity] = dists[capacity][i] = distance.squaredDistance(ci, newchild);
        if(d > maxd) {
          maxd = d;
          m1 = i;
          m2 = capacity;
        }
      }
      // Reset node statistics:
      node.resetStatistics();
      newn.resetStatistics();
      // Redistribute entries:
      int si = 0, sj = 0; // Output positions.
      double[] d1s = dists[m1], d2s = dists[m2];
      for(int i = 0; i < capacity; i++) {
        double d1 = d1s[i], d2 = d2s[i];
        if(i == m1 || i != m2 && (d1 < d2 || (d1 == d2 && si <= sj))) {
          node.addToStatistics(node.children[si++] = node.children[i]);
        }
        else {
          newn.addToStatistics(newn.children[sj++] = node.children[i]);
        }
      }
      {
        double d1 = d1s[capacity], d2 = d2s[capacity];
        if(capacity != m2 && (d1 < d2 || (d1 == d2 && si <= sj))) {
          node.addToStatistics(node.children[si++] = newchild);
        }
        else {
          newn.addToStatistics(newn.children[sj++] = newchild);
        }
      }
      for(int j = si; j < capacity; j++) {
        node.children[j] = null;
      }
      for(int j = sj; j < capacity; j++) {
        assert (newn.children[j] == null);
      }
      return newn;
    }