Convert hex string to integer