The major problem (I'm guessing a little bit) is that you tried .remove(255) and it did not work.
That's because of an unfortunate quirk. This code seems extremely simple:
float a = 5;
List<Float> list = new ArrayList<Float>();
list.add(a);
list.remove(5.0);
// or even
list.remove(5);
The above code is broken. It compiles fine. It runs fine (well, the last one throws at runtime with a bizarre error message if you don't follow what is going on). And nevertheless, your list still contains 5.0 once it's ran. ??? What is going on here??
What is going on?
There are 2 list.remove methods: One removes by value (you pass the value: The list will search all of the things it contains for that value and removes it), the other is by index: Remove the 9th value. They are different by way of argument type: The 'remove by value' one takes an Object, the 'remove by index' one an int. That's how java knows which one you want: What is the type of thing you pass to remove? Is it int, or Object?
When you write .remove(5), you are removing by index. It gets complicated when you have a list of numbers, .remove(5) is ambiguous: Do you mean: Remove the 5th number, or do you mean: Remove the number 5?
This confusion explains why .remove(5) doesn't get the job done. Java always interprets that as: Remove by index. Even for a List<Integer>, it would do that.
Then, there's autoboxing. Java needs to convert your primitive to an Object in order to call the remove-by-value variant. 5.0 is converted to a Double. Which is also an object. It seems weird, but you can ask a list of Cats to remove a certain Dog: The list will just go: Oookay. And do nothing. It doesn't throw an exception, and it lets you write it. Contrast to add: You can't write List<Cat> cats = ...; cats.add(new Dog()). But you can write cats.remove(new Dog()) just fine, under the theory that asking a list to remove something that isn't even in it, is fine, and is done by not doing anything.
That explains why list.remove(5.0) compiles, runs, and does nothing: It is asking to remove the Double with value 5.0, which your list doesn't have. It has a Float with value 5.0 and java does not treat those as the same.
You're doing .remove("5") which is even weirder: That is the string "5" which is utterly unrelated to the double or the float 5. Java does not try to conflate different concepts representing the same thing ("5", 5F, 5D and 5 are all different things).
How to fix it
Stop using float. Use double instead. There is almost never a good reason for floats: The fact that they are smaller is rarely going to actually happen (64-bit architecture being what it is), and if it does, it is extremely rare you're in the tiny bandwidth where the savings of a float is worth it, but rewriting the code to use an algorithm that avoids floating point altogether is not. Double is a first class citizen in java, float is not. For example, 255.0 is a double. Not a float.
Next, dance around the fact that .remove is a bit daft. Cast to object to ensure it:
List<Integer> x = new ArrayList<Integer>();
list.add(2, 1, 0);
list.remove(0); // this removes the 2!!! Because that is the item at index 0
list.remove((Object) 0); // this really does remove the 0.
System.out.println(list);
> [1]
Finally, ensure the things you try to remove match what is in your list. If you have a list of floats with 255 in it, that'd be 255F. Not 255, not 255.0 (which is a double). 255D and 255.0 are the same, though:
List<Double> list = new ArrayList<Double>();
list.add(255.0);
list.remove(255.0); // this works
list.remove(255); // this doesn't
list.remove((Object) 255); // this removes nothing! 255 isn't the same as 255.0.