Possible Duplicate:
What is the easiest/best/most correct way to iterate through the characters of a string in Java?
What I'm considering is time and efficiency. With those in mind, which method (among the ones below or others not mentioned) is the most efficient way to go through each character of a string?
String str = "Foo Bar";
for(int i=0;i<str.length();i++)
System.out.println(str.charAt(i)); // access the character using .charAt()
for(char letter: str.toCharArray)
System.out.println(letter); // use for-each loop with the char array.
Again, there might be a better way to do this, but I also am curious if there is are major time/resources differences between the two above.