### Question:
Address extends AbstractAddress { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { return Address.fromBase58(null, address).getParameters(); } private  Address(NetworkParameters params, boolean p2sh, byte[] hash160); @Deprecated  Address(NetworkParameters params, byte[] hash160); static Address fromString(@Nullable NetworkParameters params, String str); static Address fromPubKeyHash(NetworkParameters params, byte[] hash160); static Address fromKey(NetworkParameters params, ECKey key); static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType); static Address fromScriptHash(NetworkParameters params, byte[] hash160); @Deprecated static Address fromP2SHHash(NetworkParameters params, byte[] hash160); @Deprecated static Address fromP2SHScript(NetworkParameters params, Script scriptPubKey); static Address fromBase58(@Nullable NetworkParameters params, String base58); int getVersion(); String toBase58(); @Deprecated byte[] getHash160(); @Override byte[] getHash(); @Override ScriptType getOutputScriptType(); @Deprecated boolean isP2SHAddress(); static NetworkParameters getParametersFromAddress(String address); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override Address clone(); static final int LENGTH; final boolean p2sh; }### Answer:
@Test public void getNetwork() throws Exception { NetworkParameters params = Address.getParametersFromAddress(CoinDefinition.UNITTEST_ADDRESS); assertEquals(MAINNET.getId(), params.getId()); params = Address.getParametersFromAddress("ydzm4Uvr2GkLxTwQnwiyijYUukk1eweBo4"); assertEquals(TESTNET.getId(), params.getId()); }
@Test public void getAltNetwork() throws Exception { class AltNetwork extends MainNetParams { AltNetwork() { super(); id = "alt.network"; addressHeader = 48; p2shHeader = 5; } } AltNetwork altNetwork = new AltNetwork(); Networks.register(altNetwork); NetworkParameters params = Address.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); assertEquals(altNetwork.getId(), params.getId()); params = Address.getParametersFromAddress("Xtqn4ks8sJS7iG7S7r1Jf37eFFSJGwh8a8"); assertEquals(MAINNET.getId(), params.getId()); Networks.unregister(altNetwork); try { Address.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); fail(); } catch (AddressFormatException e) { } }