question: String checkString ( String s , int base ) { if ( s == null ) { throw new NullPointerException ( "s == null" ) ; } int charCount = s . length ( ) ; int i = 0 ; if ( charCount > 0 ) { char ch = s . charAt ( 0 ) ; if ( ch == '+' ) { s = s . substring ( 1 ) ; -- charCount ; } else if ( ch == '-' ) { ++ i ; } } if ( charCount - i == 0 ) { throw invalidBigInteger ( s ) ; } boolean nonAscii = false ; for ( ; i < charCount ; ++ i ) { char ch = s . charAt ( i ) ; if ( Character . digit ( ch , base ) == - 1 ) { throw invalidBigInteger ( s ) ; } if ( ch > 128 ) { nonAscii = true ; } } return nonAscii ? toAscii ( s , base ) : s ; }
target:  Returns a string suitable for passing to OpenSSL. Throws if 's' doesn't match Java's rules for valid BigInteger strings. BN_dec2bn and BN_hex2bn do very little checking, so we need to manually ensure we comply with Java's rules. http://code.google.com/p/android/issues/detail?id=7036