Java BASE64加密解密 sun.misc包是Sun公司提供给内部使用的专用API,不建议使用。另外apache已经实现了一套:
参考org.apache.commons.codec.binary.Base64
下载地址:http://commons.apache.org/codec/download_codec.cgi

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
 * BASE64加密解密
 */
public class BASE64
{
    /**
     * BASE64解密
   * @param key
     * @return
     * @throws Exception
     */
    public static byte[] decryptBASE64(String key) throws Exception {
        return (new BASE64Decoder()).decodeBuffer(key);
    }
    /**
     * BASE64加密
   * @param key
     * @return
     * @throws Exception
     */
    public static String encryptBASE64(byte[] key) throws Exception {
        return (new BASE64Encoder()).encodeBuffer(key);
    }
    public static void main(String[] args) throws Exception
    {
        String data = BASE64.encryptBASE64("法证先锋 第二部".getBytes());
        System.out.println("加密前:"+data);
        //5rOV6K+B5YWI6ZSLIOesrOS6jOmDqA==
        byte[] byteArray = BASE64.decryptBASE64(data);
        System.out.println("解密后:"+new String(byteArray));
    }
}