How to use if else statement in java?