You can achieve it using this single line code :
String numbers = text.substring(text.length() - 7, text.length());
But be sure to catch Exception if the input string length is less than 7.
You can replace 7 with any number say N, if you want to get last 'N' characters.