Java implementation of k-means clustering algorithm