String result = new sun.misc.BASE64Encoder().encode(bytes); //具体的编码方法 byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(result);