whats best way to check if a number is an integer?

Ive heard of doing it this way

test = Math.floor(num1);
if(test == num1)
System.out.println("integer");

any...