public static BigIntStringChecksum fromStringOrNull ( String bics ) { BigIntStringChecksum ret ; if ( bics == null ) { ret = null ; } else if ( ! startsWithPrefix ( bics ) ) { ret = null ; } else { try { ret = fromString ( bics ) ; // completely test the input: make sure // asBigInteger will throw a SecretShareException on error if ( ret . asBigInteger ( ) == null ) { // asBigInteger() is not allowed to return null. // but just in case it does: throw new SecretShareException ( "Programmer error converting '" + bics + "' to BigInteger" ) ; } } catch ( SecretShareException e ) { ret = null ; } } return ret ; }
Take string as input and either return an instance or return null .