1for(int i=0; i<yourString.length();i++) {
2 if(Character.isDigit(yourString.charAt(i))) {
3 // Do something with the number
4 // For example convert it to int:
5 int yourNumber = Integer.parseInt(String.valueOf(yourString.charAt(i)));
6 }
7}
1public static BigInteger lastBigInteger(String s) {
2 int i = s.length();
3 while (i > 0 && Character.isDigit(s.charAt(i - 1))) {
4 i--;
5 }
6 return new BigInteger(s.substring(i));
7}