TDAT: private boolean vectorsToNearestCentroid() { boolean converged = true; for (int i = 0; i < data.size(); ++i) { // Find centroid closest to current vector. int nearest = data.get(i).nearest(centroids); // If there was a change then there is no convergence. if (nearest != nearestCentroid[i]) { converged = false; } nearestCentroid[i] = nearest; } return converged; } COM: pre set data