how to check if character is null in java