Using Nested If Function Java