sun.security.util
Class ByteArrayLexOrder
java.lang.Object
sun.security.util.ByteArrayLexOrder
- All Implemented Interfaces:
- Comparator
public class ByteArrayLexOrder
- extends Object
- implements Comparator
Compare two byte arrays in lexicographical order.
|
Method Summary |
int |
compare(Object obj1,
Object obj2)
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 |
ByteArrayLexOrder
public ByteArrayLexOrder()
compare
public final int compare(Object obj1,
Object obj2)
- 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 interface Comparator
- 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.
- Throws:
ClassCastException - if either argument is not a byte array.