public static BigIntStringChecksum fromString ( String bics ) { boolean returnIsNegative = false ; BigIntStringChecksum ret = null ; if ( bics == null ) { createThrow ( "Input cannot be null" , bics ) ; } if ( startsWithPrefix ( bics ) ) { String noprefix = bics . substring ( PREFIX_BIGINT_DASH_CHECKSUM . length ( ) ) ; String noprefixnosign = noprefix ; if ( noprefixnosign . startsWith ( "-" ) ) { returnIsNegative = true ; noprefixnosign = noprefixnosign . substring ( 1 ) ; } String [ ] split = noprefixnosign . split ( "-" ) ; if ( split . length <= 1 ) { createThrow ( "Missing checksum section" , bics ) ; } else { String asHex = "" ; if ( returnIsNegative ) { asHex = "-" ; } for ( int i = 0 , n = split . length - 1 ; i < n ; i ++ ) { asHex += split [ i ] ; } String computedMd5sum = computeMd5ChecksumLimit6 ( asHex ) ; String givenMd5sum = split [ split . length - 1 ] ; if ( computedMd5sum . equalsIgnoreCase ( givenMd5sum ) ) { ret = new BigIntStringChecksum ( asHex , computedMd5sum ) ; } else { createThrow ( "Mismatch checksum given='" + givenMd5sum + "' computed='" + computedMd5sum + "'" , bics ) ; } } } else { createThrow ( "Input must start with '" + PREFIX_BIGINT_DASH_CHECKSUM + "'" , bics ) ; } // The call to .asBigInteger() should never throw an exception at this point. // But, if it is going to throw an exception, it is better to do it now rather than later: ret . asBigInteger ( ) ; return ret ; }
Take input string and create the instance . As of version 1 . 3 . 2 forward the case of the INPUT is not relevant . Note however that when the Checksum CCCCCC is computed the hex hhhhhh - string is LOWER CASE .