Java separa los números de la cadena
// string contains numbers
String str = "The price of the book is $49";
// extract digits only from strings
String numberOnly = str.replaceAll("[^0-9]", "");
// print the digitts
System.out.println(numberOnly);
Magnificent Monkey Adi