Class ByteArrayLexOrder
java.lang.Object
org.mozilla.jss.netscape.security.util.ByteArrayLexOrder
- All Implemented Interfaces:
Serializable
,Comparator<byte[]>
Compare two byte arrays in lexicographical order.
- Version:
- 1.4 97/12/10
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
compare
(byte[] bytes1, byte[] bytes2) Perform lexicographical comparison of two byte arrays, regarding each byte as unsigned.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ByteArrayLexOrder
public ByteArrayLexOrder()
-
-
Method Details
-
compare
public final int compare(byte[] bytes1, byte[] bytes2) Perform lexicographical comparison of two byte arrays, regarding each byte as unsigned. That is, compare array entries in order until they differ--the array with the smaller entry is "smaller". If array entries are equal till one array ends, then the longer array is "bigger".- Specified by:
compare
in interfaceComparator<byte[]>
- Parameters:
bytes1
- first byte array to compare.bytes2
- second byte array to compare.- Returns:
- negative number if bytes1 < bytes2, 0 if bytes1 == bytes2, positive number if bytes1 > bytes2.
-