A map is not an appropriate data structure. Use TreeSet :
TreeSet<Float> numbers = new TreeSet<>();
This will be very good: TreeSet finds the insertion point in O (log n) time (for example, binary search), and the returned list is just a view (no new list is created), so the whole operation is easy.
Also note that the elements do not need to be added in any particular order - the TreeSet internally maintains its order, so the search is quick.
Here are some test codes:
TreeSet<Float> numbers = new TreeSet<>(Arrays.asList( 0.607F, 0.647F, 0.127F, 0.167F, 0.207F, 0.247F, 0.237F, 0.327F, 0.367F, 0.407F, 0.447F, 0.487F, 0.527F, 0.567F, 0.652F));
Output:
10
source share