how to know if a number is whole number in java code example Example: how to check if number is integer in java if(x == (int)x){ println("x is an integer"); }