docs: public void truncate(int newsize) {
      if(newsize < size) {
        double[] odists = dists;
        dists = new double[newsize];
        System.arraycopy(odists, 0, dists, 0, newsize);
        int[] oids = ids;
        ids = new int[newsize];
        System.arraycopy(oids, 0, ids, 0, newsize);
        size = newsize;
      }
    }