title: how to implement k-means for simple grouping in java
body: <p>I would like to know simple k-means algorithm in java. I want to use k-means only for grouping one dimensional array not multi.
  For example,
  before grouping the array consists of  2,4,7,5,12,34,18,25
  if we want four group then we got 
  group 1: 2,4,5
  group 2: 7,12
  group 3: 18,25
  group 4: 34</p>