@Test public void testCompareTo() { Hash a = Hash.fromString("000000"); Hash b = Hash.fromString("000123"); assertTrue(a.compareTo(b) < 0); assertTrue(b.compareTo(a) > 0); }
@Override public int compareTo(Hash o) { if (bytes.length != o.bytes.length) { return bytes.length - o.bytes.length; } BigInteger a = new BigInteger(1, bytes); BigInteger b = new BigInteger(1, o.bytes); return a.compareTo(b); }
Hash implements Comparable<Hash> { @Override public int compareTo(Hash o) { if (bytes.length != o.bytes.length) { return bytes.length - o.bytes.length; } BigInteger a = new BigInteger(1, bytes); BigInteger b = new BigInteger(1, o.bytes); return a.compareTo(b); } }
Hash implements Comparable<Hash> { @Override public int compareTo(Hash o) { if (bytes.length != o.bytes.length) { return bytes.length - o.bytes.length; } BigInteger a = new BigInteger(1, bytes); BigInteger b = new BigInteger(1, o.bytes); return a.compareTo(b); } Hash(byte[] bytes); }
Hash implements Comparable<Hash> { @Override public int compareTo(Hash o) { if (bytes.length != o.bytes.length) { return bytes.length - o.bytes.length; } BigInteger a = new BigInteger(1, bytes); BigInteger b = new BigInteger(1, o.bytes); return a.compareTo(b); } Hash(byte[] bytes); byte[] getBytes(); String getBytesAsString(); static Hash fromString(String str); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(Hash o); static Hash hash(Object input, HashAlgorithm alg); static Hash hash160(byte[] bytes); static Hash hash256(byte[] bytes); static Hash sha256(byte[] bytes); static Hash ripemd160(byte[] bytes); static Hash sha1(byte[] bytes); static Hash hash160(Hash obj); static Hash hash256(Hash obj); static Hash ripemd160(Hash obj); static Hash sha256(Hash obj); static Hash sha1(Hash obj); static Hash hash160(String obj); static Hash hash256(String obj); static Hash ripemd160(String obj); static Hash sha256(String obj); static Hash sha1(String obj); static Hash hash160(Boolean obj); static Hash hash256(Boolean obj); static Hash ripemd160(Boolean obj); static Hash sha256(Boolean obj); static Hash sha1(Boolean obj); static Hash hash160(Number obj); static Hash hash256(Number obj); static Hash ripemd160(Number obj); static Hash sha256(Number obj); static Hash sha1(Number obj); }
Hash implements Comparable<Hash> { @Override public int compareTo(Hash o) { if (bytes.length != o.bytes.length) { return bytes.length - o.bytes.length; } BigInteger a = new BigInteger(1, bytes); BigInteger b = new BigInteger(1, o.bytes); return a.compareTo(b); } Hash(byte[] bytes); byte[] getBytes(); String getBytesAsString(); static Hash fromString(String str); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(Hash o); static Hash hash(Object input, HashAlgorithm alg); static Hash hash160(byte[] bytes); static Hash hash256(byte[] bytes); static Hash sha256(byte[] bytes); static Hash ripemd160(byte[] bytes); static Hash sha1(byte[] bytes); static Hash hash160(Hash obj); static Hash hash256(Hash obj); static Hash ripemd160(Hash obj); static Hash sha256(Hash obj); static Hash sha1(Hash obj); static Hash hash160(String obj); static Hash hash256(String obj); static Hash ripemd160(String obj); static Hash sha256(String obj); static Hash sha1(String obj); static Hash hash160(Boolean obj); static Hash hash256(Boolean obj); static Hash ripemd160(Boolean obj); static Hash sha256(Boolean obj); static Hash sha1(Boolean obj); static Hash hash160(Number obj); static Hash hash256(Number obj); static Hash ripemd160(Number obj); static Hash sha256(Number obj); static Hash sha1(Number obj);  }