handling overflow test case
if ( Base > int . MaxValue / 10 || ( Base == int . MaxValue / 10 && str [ i ] - '0' > 7 ) ) { if ( sign == 1 ) return int . MaxValue ; else return int . MinValue ; } Base = 10 * Base + ( str [ i ++ ] - '0' ) ; } return Base * sign ; }