private boolean isInt(String s){
try{
Integer.parseInt(s);
return true;
}catch (NumberFormatException e){
return false;
}
}
public static boolean isNumeric(String strNum) {
if (strNum == null) {
return false;
}
try {
double d = Double.parseDouble(strNum);
} catch (NumberFormatException nfe) {
return false;
}
return true;
}
public class ContainsExample {
public static void main(String args[]){
String sample = "krishna64";
char[] chars = sample.toCharArray();
StringBuilder sb = new StringBuilder();
for(char c : chars){
if(Character.isDigit(c)){
sb.append(c);
}
}
System.out.println(sb);
}