Number160 extends Number implements Comparable<Number160> { @Override public int compareTo(final Number160 o) { for (int i = 0; i < INT_ARRAY_SIZE; i++) { long b1 = val[i] & LONG_MASK; long b2 = o.val[i] & LONG_MASK; if (b1 < b2) { return -1; } else if (b1 > b2) { return 1; } } return 0; } Number160();  Number160(final int... val);  Number160(final String val);  Number160(final int val);  Number160(final long val);  Number160(final byte[] val);  Number160(final byte[] val, final int offset, final int length);  Number160(final Random random);  Number160(final long timestamp, Number160 number96); long timestamp(); Number160 number96(); Number160 xor(final Number160 key); int[] toIntArray(); int toByteArray(final byte[] me, final int offset); byte[] toByteArray(); String toString(final boolean removeLeadingZero); boolean isZero(); int bitLength(); @Override String toString(); @Override double doubleValue(); @Override float floatValue(); @Override int intValue(); @Override long longValue(); @Override int compareTo(final Number160 o); @Override boolean equals(final Object obj); @Override int hashCode(); static Number160 createHash(final int integerValue); static Number160 createHash(final long longValue); static Number160 createHash(final String string); static final int BITS; static final int INT_ARRAY_SIZE; static final int BYTE_ARRAY_SIZE; static final int CHARS_PER_INT; static final Number160 ZERO; static final Number160 ONE; static final Number160 MAX_VALUE; }
@Test public void testLength() { Number160 bi1 = new Number160("0x7f"); Number160 bi2 = new Number160("0x80"); Number160 bi3 = new Number160("0xff"); Assert.assertEquals(false, bi1.compareTo(bi2) == 0); Assert.assertEquals(bi3, PeerMap.distance(bi1, bi2)); Assert.assertEquals(7, PeerMap.classMember(bi1, bi2)); Assert.assertEquals(6, PeerMap.classMember(bi2, bi3)); }