How to check if a double value has no decimal part [duplicate]

Solution 1:

You could simply do

d % 1 == 0

to check if double d is a whole.

Solution 2:

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");