Decode base16 chars to bytes.

@param src   Chars to decode.

@return Decoded bytes.
769550
public static byte[] decode(char[] src) {
        byte[] dst = new byte[src.length / 2];

        for (int si = 0, di = 0; di < dst.length; di++) {
            byte high = decode[src[si++] & 0x7f];
            byte low  = decode[src[si++] & 0x7f];
            dst[di] = (byte) ((high << 4) + low);
        }

        return dst;
    }
415529
protected V decode(String value) {
    return valueSerializer.decode(BaseEncoding.base16().decode(value));
  }
188467
public static long getUInt32(byte[] src, int offset) {
        final long v0 = src[offset] & 0xFF;
        final long v1 = src[offset + 1] & 0xFF;
        final long v2 = src[offset + 2] & 0xFF;
        final long v3 = src[offset + 3] & 0xFF;
        return ((v3 << 24) | (v2 << 16) | (v1 << 8) | v0);
    }
1326928
@Nonnull
    static String convertStringToPlainAscii(@Nonnull final String string) {
        return Decoder.decodeUTF16(string.toUpperCase());
    }
1268148
public static byte[] decode(String str) throws CoderException {
	byte out[] = new byte[str.length()];
	int len = 0;
	int offset = 0;
	// int current = 0;
	byte b = 0;
	boolean stop = false;
	StringCharacterIterator it = new StringCharacterIterator(str);
	do {
	    b = _dec(it.current());
	    it.next();
	    if (b > 45) throw new CoderException("can't decode string [" + str + "]");
	    if (b < 45) stop = true;
	    len += b;
	    for (; b > 0; b -= 3) {
		decodeChars(it, out, offset);
		offset += 3;
	    }
	    it.next();
	}
	while (!stop);
	byte rtn[] = new byte[len];
	for (int i = 0; i < len; i++)
	    rtn[i] = out[i];

	return rtn;
    }
539266
def _decode16(self, offset):
        
        str_len, skip = self._decode_length(offset, 2)
        offset += skip

        # The len is the string len in utf-16 units
        encoded_bytes = str_len * 2

        data = self.m_charbuff[offset: offset + encoded_bytes]

        assert self.m_charbuff[offset + encoded_bytes:offset + encoded_bytes + 2] == b"\x00\x00", \
            "UTF-16 String is not null terminated! At offset={}".format(offset)

        return self._decode_bytes(data, 'utf-16', str_len)
941313
private static int decodeBase31(@Nonnull final String code) {
        int value = 0;
        for (final char c : code.toCharArray()) {
            if (c == '.') {
                return value;
            }
            if (DECODE_CHARS[c] < 0) {
                return -1;
            }
            value = (value * 31) + DECODE_CHARS[c];
        }
        return value;
    }
151671
public static Character decodeCharacterObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int b = src[srcOffset];
            if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
                return null;
            }
            return decodeChar(src, srcOffset + 1);
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
184536
@Override
    public void decode(byte[] bytes, StringBuilder buffer) {
        if (bytes == null) {
            // append nothing
            return;
        }

        char[] table = CHAR_TABLE;
        for (int i = 0; i < bytes.length; i++) {
            int code = (int)bytes[i] & 0x000000ff;
            if (code == EXTENDED_ESCAPE) {
                // take next char from extension table
                table = EXT_CHAR_TABLE;
            } else {
                buffer.append((code >= table.length) ? '?' : table[code]);
                // go back to the default table
                table = CHAR_TABLE;
            }
        }
    }
1022521
private static CharSequence decode0(final CharSequence s) {
    final int length = s.length();
    final CharBuffer cb = CharBuffer.allocate(length);

    for (int i = 0; i < length; ) {
      final char c = s.charAt(i);

      // Not encoded?
      if (c != '%') {
        cb.append(c);
        i++;
        continue;
      }

      // UTF8 - 1 Byte
      int b1 = decodePercent(s, length, i);
      if (b1 == INVALID) {
        return null;
      }
      i += 3;
      final int n = utf8Length(b1);
      if (n == INVALID) {
        return null;
      }
      if (n == 1) {
        cb.append((char) b1);
        continue;
      }

      // UTF8 - 2 Bytes
      final int b2 = decodePercent(s, length, i);
      if (b2 == INVALID) {
        return null;
      }
      i += 3;
      if (n == 2) {
        final int cp = utf8Read2(b1, b2);
        if (cp == INVALID) {
          return null;
        }
        cb.append((char) cp);
        continue;
      }

      // UTF8 - 3 Bytes
      final int b3 = decodePercent(s, length, i);
      if (b3 == INVALID) {
        return null;
      }
      i += 3;
      if (n == 3) {
        final int cp = utf8Read3(b1, b2, b3);
        if (cp == INVALID) {
          return null;
        }
        cb.append((char) cp);
        continue;
      }

      // UTF8 - 4 Bytes
      final int b4 = decodePercent(s, length, i);
      if (b4 == INVALID) {
        return null;
      }
      i += 3;
      final int cp = utf8Read4(b1, b2, b3, b4);
      if (cp == INVALID) {
        return null;
      }
      final int offset = cp - MIN_SUPPLEMENTARY_CODE_POINT;
      cb.append((char) ((offset >>> 10) + MIN_HIGH_SURROGATE));
      cb.append((char) ((offset & 0x3ff) + MIN_LOW_SURROGATE));
    }

    cb.flip();
    return cb;
  }
626897
public static HashSet<Character> toCharacterSet(String src) {
    int n = src.length();
    HashSet<Character> res = new HashSet<>(n);
    for (int i = 0; i < n; i++)
      res.add(src.charAt(i));
    return res;
  }

  public static Character[] toCharacterArray(String src) {
    return ArrayUtils.box(src.toCharArray());
  }

  public static int unhex(String str) {
    int res = 0;
    for (char c : str.toCharArray()) {
      if (!hexCode.containsKey(c)) throw new NumberFormatException("Not a hexademical character " + c);
      res = (res << 4) + hexCode.get(c);
    }
    return res;
  }

  public static byte[] bytesOf(CharSequence str) {
    return str.toString().getBytes(Charset.forName("UTF-8"));
  }

  public static byte[] toBytes(Object value) {
    return bytesOf(String.valueOf(value));
  }
  
  public static String toString(byte[] bytes, int from, int length) {
    return new String(bytes, from, length, Charset.forName("UTF-8"));
  }
}
1372262
public static byte[] decode(String s) {
		byte[] bytes;
		try {
			bytes = s.getBytes(PREFERRED_ENCODING);
		} // end try
		catch (java.io.UnsupportedEncodingException uee) {
			bytes = s.getBytes();
		} // end catch

		// Decode
		bytes = decode(bytes);

		return bytes;
	}
1284443
static public byte[] decode(String base32) {
        String string = base32.replaceAll("\\s", "");  // remove all white space
        int length = string.length();
        byte[] bytes = new byte[(int) (length * 5.0 / 8.0)];
        for (int i = 0; i < length - 1; i++) {
            char character = string.charAt(i);
            byte chunk = (byte) lookupTable.indexOf((int) character);
            if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string);
            decodeCharacter(chunk, i, bytes, 0);
        }
        if (length > 0) {
            char character = string.charAt(length - 1);
            byte chunk = (byte) lookupTable.indexOf((int) character);
            if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string);
            decodeLastCharacter(chunk, length - 1, bytes, 0);
        }
        return bytes;
    }
858417
public static boolean decodeBoolean(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            return src[srcOffset] == (byte)128;
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
102845
private final static String escape(String src) {
        if (src == null) {
            return "";
        }
        StringBuffer result = null;
        for (int i = 0, max = src.length(), delta = 0; i < max; i++) {
            char c = src.charAt(i);
            if (!Character.isWhitespace(c) && Character.isISOControl(c) || Character.getType(c) == Character.UNASSIGNED) {
                String hexVal = Integer.toHexString(c);
                String replacement = "\\u" + ("0000" + hexVal).substring(hexVal.length());
                if (result == null) {
                    result = new StringBuffer(src);
                }
                result.replace(i + delta, i + delta + 1, replacement);
                delta += replacement.length() - 1;
            }
        }
        if (result == null) {
            return src;
        } else {
            return result.toString();
        }
    }
39756
public static String decodeStr(String source, String charset) {
		return Base64Decoder.decodeStr(source, charset);
	}
650501
public static Double decodeDoubleObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        long bits = decodeDoubleBits(src, srcOffset);
        bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL;
        return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
    }