private static boolean isInteger ( Number n ) { if ( n instanceof Integer ) { return true ; } try { Integer . parseInt ( String . valueOf ( n ) ) ; return true ; } catch ( NumberFormatException e ) { return false ; } }
Finds out if n represents an Integer .