java中,怎么判断一个数是整数

如题所述

if(z == int (z)){
prt("整形")
}
或者
整型/整型=整型

所以结果Z一定是整型,不需要判断

但是如果你想判断的话可以这样

Z=(L-x+y)/(n-m);

temp=(L-x+y)/ (float)(n-m);

这个时候只要判断 (temp>Z)? 就可以了
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-11-08
匹配非负整数(正整数 + 0)
public static final String non_negative_integers_regexp = "^\\d+$";
匹配不包括零的非负整数(正整数 > 0)
public static final String non_zero_negative_integers_regexp = "^[1-9]+\\d*$";
匹配正整数
public static final String positive_integer_regexp = "^[0-9]*[1-9][0-9]*$";
第2个回答  2011-11-08
if A.aa - A.0 <> 0
true

这是逻辑 不只在java 语言
第3个回答  2011-11-08
来看看
相似回答