Code:
public class Numerize {
final static private String allnums = "0123456789";
public static String filter(String s1){
char[] arr = s1.toCharArray();
String result="";
for (char ot:arr) {
if(allnums.contains(ot + "")){result+= ot;}
}
return result;
}
}