public static int parseInt(String string,int radix) throws NumberFormatException {
  if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {
    throw new NumberFormatException("Invalid radix: " + radix);
  }
  if (string == null) {
    throw invalidInt(string);
  }
  int length=string.length(), i=0;
  if (length == 0) {
    throw invalidInt(string);
  }
  boolean negative=string.charAt(i) == '-';
  if (negative && ++i == length) {
    throw invalidInt(string);
  }
  return parse(string,i,radix,negative);
}

public static int parseInt ( String string , int radix ) throws NumberFormatException { if ( radix < Character . MIN_RADIX || radix > Character . MAX_RADIX ) { throw new NumberFormatException ( "Invalid radix: " + radix ) ; } if ( string == null ) { throw invalidInt ( string ) ; } int length = string . length ( ) , i = 0 ; if ( length == 0 ) { throw invalidInt ( string ) ; } boolean negative = string . charAt ( i ) == '-' ; if ( negative && ++ i == length ) { throw invalidInt ( string ) ; } return parse ( string , i , radix , negative ) ; }
parses the string argument as a signed integer in the radix specified by the second argument . the characters in the string must all be digits of the specified radix ( as determined by whether returns a nonnegative value ) , except that the first character may be an ascii minus sign ' - ' ( ' u002d ' ) to indicate a negative value . the resulting integer value is returned . an exception of type numberformatexception is thrown if any of the following situations occurs : the first argument is null or is a string of length zero . the radix is either smaller than character . min_radix or larger than character . max_radix . any character of the string is not a digit of the specified radix , except that the first character may be a minus sign ' - ' ( ' u002d ' ) provided that the string is longer than length 1 . the integer value represented by the string is not a value of type int . examples : parseint ( " 0 " , 10 ) returns 0 parseint ( " 473 " , 10 ) returns 473 parseint ( " - 0 " , 10 ) returns 0 parseint ( " - ff " , 16 ) returns - 255 parseint ( " 1100110 " , 2 ) returns 102 parseint ( " 2147483647 " , 10 ) returns 2147483647 parseint ( " - 2147483648 " , 10 ) returns - 2147483648 parseint ( " 2147483648 " , 10 ) throws a numberformatexception parseint ( " 99 " , 8 ) throws a numberformatexception parseint ( " kona " , 10 ) throws a numberformatexception parseint ( " kona " , 27 ) returns 411787
