static double length(ObjectToCounterMap<String> otc) { double sum = 0.0; for (Counter counter : otc.values()) { double count = counter.doubleValue(); sum += count; // tf =sqrt(count); sum += tf * tf } return Math.sqrt(sum); }