Integer cannot be cast into Float?

The 0 in attributes.put("dist", 0); becomes an Integer.
Use 0.0 instead, so it is stored as a Float: attributes.put("dist", 0.0);
Otherwise, use (Integer) as cast: float dist = (Integer) attributes.get("dist");

2 Likes