Model based clustering make assumptions about clusters which randomly chosen at the beginning. At expectation maximization we can use probability density function to get a model of a cluster that we created before and move objects between clusters to create perfect (smallest) standard deviation from the cluster model. To do this we can find the occurrence probability of an object in cluster.
You can find an implementation of EM algorithm below;
And do not forget to download commons-lang3-3.0 library from apache site.