Is it OK to compare an int and a long in Java

Solution 1:

Yes, that's fine. The int will be implicitly converted to a long, which can always be done without any loss of information.