In order to compare two float value, we usually use the compare and compareto method of Float class. And also if we are doing some complicated comparison, we can opt in in using our own comparator. With the addition of max(float a, float b) value as of Java 8. we can now have the capability of getting the greatest number between two float numbers. This is quite convenient to use, and make our code more readable. But make a note that this method is solely used to get which of the two float numbers is the greatest.