判断整数:
public static void main(String[] args) {
String pattern="-?[1-9]\\d*|0";
Pattern compile = compile(pattern);
Matcher matcher = compile.matcher("-1");
if (matcher.matches()) {
System.out.println("true");
}else{
System.out.println("false");
}
}