DistanceMeasure
(link) is just an Interface. You need to use one of the implementations of the interface, for example CosineDistanceMeasure
or EuclideanDistanceMeasure
By the way, I wonder why your delta is defined like this: String delta = new InterruptedException().toString();
delta
is defined as the convergence delta value, which internally is parsed as a double.