You should be careful when comparing floating-point values (float or double) using relational operators: ==, !=, < and so on. These operators give results according to the binary representations of the floating point values. For example:
public class CompareTest {
public static void main...