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;
}

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 ; }
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
