Is there any method or quick way to check whether a number is an Integer (belongs to Z field) in Java?
I thought of maybe subtracting it from the rounded number, but
With Z I assume you mean Integers , i.e 3,-5,77 not 3.14, 4.02 etc.
A regular expression may help:
Pattern isInteger = Pattern.compile("\\d+");