Package netscape.security.util
Class ByteArrayLexOrder
- java.lang.Object
-
- netscape.security.util.ByteArrayLexOrder
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Comparator<byte[]>
public class ByteArrayLexOrder extends java.lang.Object implements java.util.Comparator<byte[]>, java.io.Serializable
Compare two byte arrays in lexicographical order.- Version:
- 1.4 97/12/10
- Author:
- D. N. Hoover
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ByteArrayLexOrder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(byte[] bytes1, byte[] bytes2)
Perform lexicographical comparison of two byte arrays, regarding each byte as unsigned.
-
-
-
Method Detail
-
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 interfacejava.util.Comparator<byte[]>
- Parameters:
obj1
- first byte array to compare.obj2
- second byte array to compare.- Returns:
- negative number if obj1 < obj2, 0 if obj1 == obj2, positive number if obj1 > obj2.
-
-