As shown below:
//Judge integer (int) private boolean isInteger(String str) {if (null == str || "".equals(str)) {return false;}Pattern pattern = Pattern.compile("^[-//+]?[//d]*$");return pattern.matcher(str).matches();} //Judge floating point numbers (double and float) private boolean isDouble(String str) {if (null == str || "".equals(str)) {return false;}Pattern pattern = Pattern.compile("^[-//+]?[.//d]*$");return pattern.matcher(str).matches();}The above method of judging whether a string is an integer or a floating point number is all the content I have shared with you. I hope you can give you a reference and I hope you can support Wulin.com more.