public static boolean isNonnegativeInteger ( String s ) { if ( isEmpty ( s ) ) return defaultEmptyOK ; try { int temp = Integer . parseInt ( s ) ; if ( temp >= 0 ) return true ; return false ; } catch ( Exception e ) { return false ; } // return(isSignedInteger(s, secondArg) // &&((isEmpty(s) && secondArg) ||(parseInt(s) >= 0) ) ); }
Returns true if string s is an integer > = 0 .