[java] How do I check whether input string contains any spaces?