Printing double as integer if there are no decimals
When comparing int and float number types for equality the int is converted to a float. See: https://stackoverflow.com/questions/41653576/is-it-safe-to-compare-a-float-and-an-int-in-java
When I was researching your problem I came across some information that said when the == operator was used the tested values where compared by reference rather than value, whereas the equals function tests values. I guess you need to research if this is the case and how it applies to your code. I am not a Java expert and have not programmed using it for 20 years.