Extract digits from string - StringUtils Java
Use this code numberOnly will contain your desired output.
String str="sdfvsdf68fsdfsf8999fsdf09";
String numberOnly= str.replaceAll("[^0-9]", "");
Just one line:
int value = Integer.parseInt(string.replaceAll("[^0-9]", ""));
I always like using Guava String utils or similar for these kind of problems:
String theDigits = CharMatcher.inRange('0', '9').retainFrom("abc12 3def"); // 123