code: protected int[] computeNearestCoarseIndices(double[] vector, int k) {
  		BoundedPriorityQueue<Result> bpq = new BoundedPriorityQueue<Result>(new Result(), k);
  
  		double lowest = Double.MAX_VALUE;
  		for (int i = 0; i < numCoarseCentroids; i++) {
  			boolean skip = false;
  			double l2distance = 0;
  			for (int j = 0; j < vectorLength; j++) {
  				l2distance += (coarseQuantizer[i][j] - vector[j]) * (coarseQuantizer[i][j] - vector[j]);
  				if (l2distance > lowest) {
  					skip = true;
  					break;
  				}
  			}
  			if (!skip) {
  				bpq.offer(new Result(i, l2distance));
  				if (i >= k) {
  					lowest = bpq.last().getDistance();
  				}
  			}
  		}
  		int[] nn = new int[k];
  		for (int i = 0; i < k; i++) {
  			nn[i] = bpq.poll().getId();
  		}
  		return nn;
  	}
docs: Returns the indices of the k coarse centroids which are closer to the given vector.
  
  @param vector
  The vector
  @param k
  The number of nearest centroids to return
  @return The indices of the k nearest coarse centroids