If you look at the getChars entry in the Java 2 API docs, you'll see that the endIndex you pass in refers to the index after the last character you want to copy, rather than the actual index of the last character, as you are assuming.
posted 17 years ago
Sorry! I should've looked at the getChars function definition not just the function declaration in the java doc before posting such a question. Thanks Felix for your help.