diff options
author | Ade Lee <alee@redhat.com> | 2012-01-11 13:58:57 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-01-11 13:58:57 -0500 |
commit | fbbf6c77236902e726faafe380a5ddf1891e8dc9 (patch) | |
tree | 1e671265cbd3d4072838eeec51b6a2ec77bed7d1 /pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java | |
parent | f7a1d6a79d1b0367e556d5c53fe5e0c07c7b5c66 (diff) | |
download | pki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.tar.gz pki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.tar.xz pki-fbbf6c77236902e726faafe380a5ddf1891e8dc9.zip |
Formatting - no wrap in comments and code
Diffstat (limited to 'pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java')
-rw-r--r-- | pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java b/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java index 60aede10..ded4522d 100644 --- a/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java +++ b/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java @@ -21,7 +21,7 @@ import java.util.Comparator; /** * Compare two byte arrays in lexicographical order. - * + * * @version 1.4 97/12/10 * @author D. N. Hoover */ @@ -29,35 +29,33 @@ public class ByteArrayLexOrder implements Comparator { /** * 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 + * 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". - * - * @param obj1 first byte array to compare. - * @param obj2 second byte array to compare. - * @return negative number if obj1 < obj2, 0 if obj1 == obj2, - * positive number if obj1 > obj2. - * - * @exception <code>ClassCastException</code> - * if either argument is not a byte array. + * + * @param obj1 first byte array to compare. + * @param obj2 second byte array to compare. + * @return negative number if obj1 < obj2, 0 if obj1 == obj2, + * positive number if obj1 > obj2. + * + * @exception <code>ClassCastException</code> if either argument is not a byte array. */ public final int compare(Object obj1, Object obj2) { - byte[] bytes1 = (byte[]) obj1; - byte[] bytes2 = (byte[]) obj2; + byte[] bytes1 = (byte[]) obj1; + byte[] bytes2 = (byte[]) obj2; - int diff; - for (int i = 0; i < bytes1.length && i < bytes2.length; i++) { - diff = (bytes1[i] & 0xFF) - (bytes2[i] & 0xFF); - if (diff != 0) { - return diff; - } - } - // if array entries are equal till the first ends, then the - // longer is "bigger" - return bytes1.length - bytes2.length; + int diff; + for (int i = 0; i < bytes1.length && i < bytes2.length; i++) { + diff = (bytes1[i] & 0xFF) - (bytes2[i] & 0xFF); + if (diff != 0) { + return diff; + } + } + // if array entries are equal till the first ends, then the + // longer is "bigger" + return bytes1.length - bytes2.length; } - } |