code: protected int findBestMatch(double[] p) {
  		int bestCluster = -1;
  		bestDistance = Double.MAX_VALUE;
  
  		for (int j = 0; j < clusters.size; j++) {
  			double d = distanceSq(p,clusters.get(j));
  			if( d < bestDistance ) {
  				bestDistance = d;
  				bestCluster = j;
  			}
  		}
  		return bestCluster;
  	}
docs: Searches for this cluster which is the closest to p