code: public static Address fromString(@Nullable NetworkParameters params, String str)
              throws AddressFormatException {
          try {
              return LegacyAddress.fromBase58(params, str);
          } catch (AddressFormatException.WrongNetwork x) {
              throw x;
          } catch (AddressFormatException x) {
              try {
                  return SegwitAddress.fromBech32(params, str);
              } catch (AddressFormatException.WrongNetwork x2) {
                  throw x;
              } catch (AddressFormatException x2) {
                  throw new AddressFormatException(str);
              }
          }
      }
docs: Construct an address from its textual form.
  
  @param params
  the expected network this address is valid for, or null if the network should be derived from the
  textual form
  @param str
  the textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL" or
  "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
  @return constructed address
  @throws AddressFormatException
  if the given string doesn't parse or the checksum is invalid
  @throws AddressFormatException.WrongNetwork
  if the given string is valid but not for the expected network (eg testnet vs mainnet)