@Test public void comparisonLessThan() throws Exception { Address a = Address.fromBase58(MAINNET, "XoVhYqRxPWkCw8WjZfiHPYsoR7g4Ny3x7K"); Address b = Address.fromBase58(MAINNET, "XpDe4AXdEf9NtW5ZBeGmuzy2VShg3qZMFQ"); int result = a.compareTo(b); assertTrue(result < 0); }
public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork { byte[] versionAndDataBytes = Base58.decodeChecked(base58); int version = versionAndDataBytes[0] & 0xFF; byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); if (params == null) { for (NetworkParameters p : Networks.get()) { if (version == p.getAddressHeader()) return new Address(p, false, bytes); else if (version == p.getP2SHHeader()) return new Address(p, true, bytes); } throw new AddressFormatException.InvalidPrefix("No network found for " + base58); } else { if (version == params.getAddressHeader()) return new Address(params, false, bytes); else if (version == params.getP2SHHeader()) return new Address(params, true, bytes); throw new AddressFormatException.WrongNetwork(version); } }
Address extends AbstractAddress { public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork { byte[] versionAndDataBytes = Base58.decodeChecked(base58); int version = versionAndDataBytes[0] & 0xFF; byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); if (params == null) { for (NetworkParameters p : Networks.get()) { if (version == p.getAddressHeader()) return new Address(p, false, bytes); else if (version == p.getP2SHHeader()) return new Address(p, true, bytes); } throw new AddressFormatException.InvalidPrefix("No network found for " + base58); } else { if (version == params.getAddressHeader()) return new Address(params, false, bytes); else if (version == params.getP2SHHeader()) return new Address(params, true, bytes); throw new AddressFormatException.WrongNetwork(version); } } }
Address extends AbstractAddress { public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork { byte[] versionAndDataBytes = Base58.decodeChecked(base58); int version = versionAndDataBytes[0] & 0xFF; byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); if (params == null) { for (NetworkParameters p : Networks.get()) { if (version == p.getAddressHeader()) return new Address(p, false, bytes); else if (version == p.getP2SHHeader()) return new Address(p, true, bytes); } throw new AddressFormatException.InvalidPrefix("No network found for " + base58); } else { if (version == params.getAddressHeader()) return new Address(params, false, bytes); else if (version == params.getP2SHHeader()) return new Address(params, true, bytes); throw new AddressFormatException.WrongNetwork(version); } } private  Address(NetworkParameters params, boolean p2sh, byte[] hash160); @Deprecated  Address(NetworkParameters params, byte[] hash160); }
Address extends AbstractAddress { public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork { byte[] versionAndDataBytes = Base58.decodeChecked(base58); int version = versionAndDataBytes[0] & 0xFF; byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); if (params == null) { for (NetworkParameters p : Networks.get()) { if (version == p.getAddressHeader()) return new Address(p, false, bytes); else if (version == p.getP2SHHeader()) return new Address(p, true, bytes); } throw new AddressFormatException.InvalidPrefix("No network found for " + base58); } else { if (version == params.getAddressHeader()) return new Address(params, false, bytes); else if (version == params.getP2SHHeader()) return new Address(params, true, bytes); throw new AddressFormatException.WrongNetwork(version); } } 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(); }
Address extends AbstractAddress { public static Address fromBase58(@Nullable NetworkParameters params, String base58) throws AddressFormatException, AddressFormatException.WrongNetwork { byte[] versionAndDataBytes = Base58.decodeChecked(base58); int version = versionAndDataBytes[0] & 0xFF; byte[] bytes = Arrays.copyOfRange(versionAndDataBytes, 1, versionAndDataBytes.length); if (params == null) { for (NetworkParameters p : Networks.get()) { if (version == p.getAddressHeader()) return new Address(p, false, bytes); else if (version == p.getP2SHHeader()) return new Address(p, true, bytes); } throw new AddressFormatException.InvalidPrefix("No network found for " + base58); } else { if (version == params.getAddressHeader()) return new Address(params, false, bytes); else if (version == params.getP2SHHeader()) return new Address(params, true, bytes); throw new AddressFormatException.WrongNetwork(version); } } 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; }