In Java, what is the best way to get the last 250 characters of a string?

advertisements

In Java what's the best way to get the last 250 characters of a string?

The string maybe empty, less than and greater than 250 chars.

Thanks


I don't exactly understand what you what, but this can do it:

if(string.length() > 250) {
     char[] lastCharacters = (string.subString(string.length-250)).toCharArray;
}