在实际的应用中,我们经常需要对字符串进行编解码,Apache Commons家族中的Commons Codec就提供了一些公共的编解码实现,比如Base64, Hex, MD5,Phonetic and URLs等等. 一.官方网址: http://commons.apache.org/codec/ 二.例子 1. Base64编解码 private static String encodeTest(String str){ Base64 base64 = new Base64(); try …