public static boolean isInteger ( String string ) { if ( string == null || string . isEmpty ( ) ) return false ; int startIndex = string . charAt ( 0 ) == ' ' ? 1 : string . charAt ( 0 ) == ' ' ? 1 : 0 ; for ( int i = startIndex , l = string . length ( ) ; i < l ; i ++ ) { if ( string . charAt ( i ) == GROUPING_SEPARATOR ) continue ; if ( ! Character . isDigit ( string . charAt ( i ) ) ) { return false ; } } return true ; }
Test if string is an integer numeric value . Returns false if string is null or empty .