docs: protected int[] refineOwners(KDTreeNode node, Instances centers,
        int[] candidates) throws Exception {
  
      int[] owners = new int[candidates.length];
      double minDistance = Double.POSITIVE_INFINITY;
      int ownerIndex = -1;
      Instance owner;
      int numCand = candidates.length;
      double[] distance = new double[numCand];
      boolean[] inside = new boolean[numCand];
      for (int i = 0; i < numCand; i++) {
        distance[i] = distanceToHrect(node, centers.instance(candidates[i]));
        inside[i] = (distance[i] == 0.0);
        if (distance[i] < minDistance) {
          minDistance = distance[i];
          ownerIndex = i;
        }
      }
      owner = (Instance)centers.instance(candidates[ownerIndex]).copy();
  
      // are there other owners
      // loop also goes over already found owner, keeps order
      // in owner list
      int index = 0;
      for (int i = 0; i < numCand; i++) {
        // 1. all centers that are points within rectangle are owners
        if ((inside[i])
  
        // 2. take all points with same distance to the rect. as the owner
            || (distance[i] == distance[ownerIndex])) {
  
          // add competitor to owners list
          owners[index++] = candidates[i];
        } else {
  
          Instance competitor = (Instance)centers.instance(candidates[i]).copy();
          if
  
          // 3. point has larger distance to rectangle but still can compete
          // with owner for some points in the rectangle
          (!candidateIsFullOwner(node, owner, competitor))
  
          {
            // also add competitor to owners list
            owners[index++] = candidates[i];
          }
        }
      }
      int[] result = new int[index];
      for (int i = 0; i < index; i++)
        result[i] = owners[i];
      return result;
    }