Problem with ArrayList<Float>

The arraylist expects a float and you are providing an integer, i can run your code by using 300.0 and 500.0 instead of 300 and 500. I guess arraylists do not work like methods and adhere to stricter variable types.

Alternatively you can cast it by using (float)300 and (float)500 or float(300) and float(500).