Some points that may be useful (Java 8).
A float can be assigned to a float primitive. Then the primitive float can be 0 checked as follows:
Float floatObj = new Float(0); float floatPrim = floatObj; if (floatPrim == 0) { System.out.println("floatPrim is 0");
However, if your Float is NULL, than assigning it a primitive will cause NPE
Float floatObj = null; float floatPrim = floatObj;
So be careful.
One more thing, apparently, you can use the == operator on the Float object, because outsourcing happens.
Float floatObj = new Float(0.0f); if (floatObj == 0) { System.out.println("floatObj is 0");
source share