@@ -54,14 +54,12 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
5454 /**
5555 * Used to build output as hex.
5656 */
57- private static final char [] DIGITS_LOWER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' ,
58- 'e' , 'f' };
57+ private static final char [] DIGITS_LOWER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' };
5958
6059 /**
6160 * Used to build output as hex.
6261 */
63- private static final char [] DIGITS_UPPER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' ,
64- 'E' , 'F' };
62+ private static final char [] DIGITS_UPPER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' };
6563
6664 /**
6765 * Converts an array of characters representing hexadecimal values into an array of bytes of those same values. The
@@ -92,16 +90,13 @@ public static byte[] decodeHex(final char[] data) throws DecoderException {
9290 */
9391 public static int decodeHex (final char [] data , final byte [] out , final int outOffset ) throws DecoderException {
9492 final int len = data .length ;
95-
9693 if ((len & 0x01 ) != 0 ) {
9794 throw new DecoderException ("Odd number of characters." );
9895 }
99-
10096 final int outLen = len >> 1 ;
10197 if (out .length - outOffset < outLen ) {
10298 throw new DecoderException ("Output array is not large enough to accommodate decoded data." );
10399 }
104-
105100 // two characters form the hex value.
106101 for (int i = outOffset , j = 0 ; j < len ; i ++) {
107102 int f = toDigit (data [j ], j ) << 4 ;
@@ -110,7 +105,6 @@ public static int decodeHex(final char[] data, final byte[] out, final int outOf
110105 j ++;
111106 out [i ] = (byte ) (f & 0xFF );
112107 }
113-
114108 return outLen ;
115109 }
116110
0 commit comments