Some times Number objects don't allow you to use direct the mod operator (%), if you are facing that case you can use this solution.
if(object instanceof Number ){
if( ((Number) object).doubleValue() % 1 == 0 ){
//your object is an integer
}
else{
//your object is a double
}
}