1 BASE64Encoder base64=new BASE64Encoder(); 2 String encoderStr=base64.encode(string.getBytes("utf-8")); 3 System.out.println(encoderStr); 4 5 BASE64Decoder base64decoder=new BASE64Decoder(); 6 byte b[]=base64decoder.decodeBuffer(encoderStr); 7 System.out.println(new String(b,"utf-8"));