//采用正则表达式的方式来判断一个字符串是否为数字,这种方式判断面比较全
//可以判断正负、整数小数
//?:0或1个, *:0或多个, +:1或多个
Boolean strResult = str.matches("-?[0-9]+.*[0-9]*");
if(strResult == true) {
System.out.println("Is Number!");
} else {
System.out.println("Is not Number!");
}