String x = "Stephen Ricard"; String[] nameparts = x.split(" "); String initials = nameparts[0].charAt(0).toUpperCase()+nameparts[1].charAt(0).toUpperCase(); //Output: SR