public static boolean isInteger(String s) {
        if (isEmpty(s)) return defaultEmptyOK;

        // Search through string's characters one by one
        // until we find a non-numeric character.
        // When we do, return false; if we don't, return true.
        for (int i = 0; i < s.length(); i++) {
            // Check that current character is number.
            char c = s.charAt(i);

            if (!isDigit(c)) return false;
        }

        // All characters are numbers.
        return true;
    }
public static boolean isInteger ( String s ) { if ( isEmpty ( s ) ) return defaultEmptyOK ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( ! isDigit ( c ) ) return false ; } return true ; }
Returns true if all characters in string s are numbers.

Accepts non-signed integers only. Does not accept floating
point, exponential notation, etc.