将 16进制字符串转换成字符串,不支持中文。</br>

@param s
16进制字符串
@return 转换后的字符串
337208
public static String decode(String s) {
		byte[] baKeyword = new byte[s.length() / 2];
		for (int i = 0; i < baKeyword.length; i++) {
			baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
		}
		return new String(baKeyword);// UTF-16le:Not
	}
745920
private static byte unescape(String s, int i) {
        return (byte) Integer.parseInt(s.substring(i+1,i+3),16);
    }
754024
public static String encode(String s) {
        if (s == null) {
            return null;
        }

        StringBuilder builder = null;
        int begin = 0;

        for (int i = 0, length = s.length(); i < length; i++) {
            char ch = s.charAt(i);

            // RFC 2396, Section 3.3.  See also:
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5063160
            switch (ch) {
                // lowalpha
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                    // upalpha
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                    // digit
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    // mark
                case '-':
                case '_':
                case '.':
                case '!':
                case '~':
                case '*':
                case '\'':
                case '(':
                case ')':
                    // path_segments
                case '/':
                    // segment
                case ';':
                    // pchar
                case ':':
                case '@':
                case '&':
                case '=':
                case '+':
                case '$':
                case ',':
                    break;

                default:
                    if (builder == null) {
                        builder = new StringBuilder();
                    }

                    builder.append(s, begin, i);
                    begin = i + 1;

                    // Reserved characters are encoded in java.io.DataInput's
                    // "modified UTF-8" format.
                    if (ch <= 0x7f) {
                        appendURLEscapeEncoding(builder, ch);
                    } else if (ch <= 0x7ff) {
                        appendURLEscapeEncoding(builder, 0xc0 | (ch >> 6));
                        appendURLEscapeEncoding(builder, 0x80 | (ch & 0x3f));
                    } else {
                        appendURLEscapeEncoding(builder, 0xe0 | (ch >> 12));
                        appendURLEscapeEncoding(builder, 0x80 | ((ch >> 6) & 0x3f));
                        appendURLEscapeEncoding(builder, 0x80 | (ch & 0x3f));
                    }
                    break;
            }
        }

        if (builder != null) {
            return builder.append(s, begin, s.length()).toString();
        }

        return s;
    }
105338
final private ByteBuffer stringToByteBuffer(CharSequence s) {
        bb.clear();
        final int len = s.length();
        for (int i = 0; i < len; i++) {
            if (bb.remaining() < 3) {
                ByteBuffer n = ByteBuffer.allocate(bb.capacity() << 1);
                bb.flip();
                n.put(bb);
                bb = n;
            }
            char c = s.charAt(i);
            if (c < 0x80) {
                bb.put((byte) c);
            } else if (c < 0x800) {
                bb.put((byte) (0xc0 | (c >> 6)));
                bb.put((byte) (0x80 | (c & 0x3f)));
            } else {
                bb.put((byte) (0xe0 | (c >> 12)));
                bb.put((byte) (0x80 | ((c >> 6) & 0x3f)));
                bb.put((byte) (0x80 | (c & 0x3f)));
            }
        }
        bb.flip();
        return bb;
    }
904453
public final int getBeInt16(final int pos) {
        final int position = origin + pos;

        if (pos + 1 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
                                                                            + (pos < 0 ? pos : (pos + 1)));

        byte[] buf = buffer;
        return (0xff & buf[position + 1]) | ((buf[position]) << 8);
    }
763391
public static String md5(String s) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            byte[] digest = md5.digest(s.getBytes(Charset.forName("UTF-8")));
            StringBuilder buf = new StringBuilder(2 * digest.length);
            for (byte oneByte : digest) {
                buf.append(Integer.toHexString((oneByte & 0xFF) | 0x100).substring(1, 3));
            }
            return buf.toString();
        } catch (NoSuchAlgorithmException ignore) { }
        return s;
    }
384984
public static String encode( String s )
    {
        byte[] sBytes = s.getBytes();
        sBytes = encode( sBytes );
        s = new String( sBytes );
        return s;
    }
852530
public static byte[] hexToBytes(String s) {
        try {
            if (s == null) return new byte[0];
            s = s.toUpperCase();
            int len = s.length();
            byte[] data = new byte[len / 2];
            for (int i = 0; i < len; i += 2) {
                data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                        + Character.digit(s.charAt(i + 1), 16));
            }
            return data;
        } catch (StringIndexOutOfBoundsException e) {
            return null;
        }
    }
997901
private static byte[] hexStringToByteArray(String s)
	{
		byte[] b = new byte[s.length() / 2];
		for (int i = 0; i < b.length; i++)
		{
			int index = i * 2;
			int v = Integer.parseInt(s.substring(index, index + 2), 16);
			b[i] = (byte) v;
		}
		return b;
	}
626734
public static String deobfuscate(String s)
    {
        if (s.startsWith("OBF:"))
            s=s.substring(4);
        
        byte[] b=new byte[s.length()/2];
        int l=0;
        for (int i=0;i<s.length();i+=4)
        {
            String x=s.substring(i,i+4);
            int i0 = Integer.parseInt(x,36);
            int i1=(i0/256);
            int i2=(i0%256);
            b[l++]=(byte)((i1+i2-254)/2);
        }

        return new String(b,0,l);
    }
8142
public static byte[] bytes(String s) {
    try {
      return s.getBytes(ENCODING);
    } catch (UnsupportedEncodingException e) {
      log.error("UnsupportedEncodingException ", e);
      throw new RuntimeException(e);
    }
  }
1359311
public static byte[] decode( String s )
    {   
        byte[] bytes = s.getBytes();
        return decode( bytes, 0, bytes.length );
    }
1104988
public static String normalize(String s) {
    StringBuilder b = new StringBuilder();
    for (int i = 0; i < s.length(); i++)
      b.append(normalize(s.charAt(i)));
    return (b.toString());
  }
237636
@Nonnegative
  public static int getUTF8ByteCount (@Nullable final String s)
  {
    return s == null ? 0 : getUTF8ByteCount (s.toCharArray ());
  }
514278
final public static Key makeSystem(String s) {
    byte[] kb= decodeKeyName(s);
    byte[] kb2 = new byte[kb.length+1];
    System.arraycopy(kb,0,kb2,1,kb.length);
    kb2[0] = Key.BUILT_IN_KEY;
    return Key.make(kb2);
  }
10982
public static String md5Hex(String s) {
    try {
      MessageDigest messageDigest = MessageDigest.getInstance("MD5");
      byte[] md5bytes = messageDigest.digest(s.getBytes("UTF-8"));
      return ByteString.of(md5bytes).hex();
    } catch (NoSuchAlgorithmException e) {
      throw new AssertionError(e);
    } catch (UnsupportedEncodingException e) {
      throw new AssertionError(e);
    }
  }
14274
public final int getBeUint16(final int pos) {
        final int position = origin + pos;

        if (pos + 1 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
                                                                            + (pos < 0 ? pos : (pos + 1)));

        byte[] buf = buffer;
        return (0xff & buf[position + 1]) | ((0xff & buf[position]) << 8);
    }