The Float.equals method compares the bit
patterns of the primitive float value. By comparing the bit patterns the unusual behavior of NaN is avoided. The javadoc for the
Float.equals method covers this issue in detail. The source code for Float.equals is as follows.