Somewhere, in code that you didn't show us, you are casting the keySet of a hash map to a TreeSet. That is not going to work. I guess you did that because of Vinoth's suggestion. But
converting the keySet to a TreeSet is not the same as
casting it. In fact, casting something doesn't do any kind of conversion at all. It just tells the compiler "I have this object here,
you should treat it as if it is a TreeSet". If then, at runtime, the object turns out not to be a TreeSet, you'll get a ClassCastException.
What you could do is use a TreeMap instead of a HashMap. Class TreeMap contains the lowerKey method that you're looking for.
By the way, using floating-point types such as Double as the keys in a map is not a good idea. Floating-point types are inherently imprecise, and maps are really made to lookup things with identifiable, exact keys.