Use for loops and have a look at java.lang.String (the api documentation onfor instance http://java.sun.com ).