package com.mzb.chzy.util;
public class CommonUtils {
/**
* 判断是否为数字
* @param str
* @return
*/
public static boolean isNumeric(String str) {
for (int i = str.length(); --i >= 0;) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
public static void main(String[] args) {
String str1 = "abc";
System.out.println(CommonUtils.isNumeric(str1));
String str2 = "123";
System.out.println(CommonUtils.isNumeric(str2));
}
}