How to check if a double value has no decimal part
You could simply do
d % 1 == 0
to check if double d
is a whole.
double d = 14.4;
if((d-(int)d)!=0)
System.out.println("decimal value is there");
else
System.out.println("decimal value is not there");
All Integers are modulo of 1. So below check must give you the answer.
if(d % 1 == 0)