Here you can find the source of decode(byte[] b)
public static byte[] decode(byte[] b) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.mail.internet.MimeUtility; public class Main { public static byte[] decode(byte[] b) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(b); InputStream b64is = MimeUtility.decode(bais, "base64"); byte[] tmp = new byte[b.length]; int n = b64is.read(tmp); byte[] res = new byte[n]; System.arraycopy(tmp, 0, res, 0, n); return res; }/*from www . ja va 2 s.co m*/ }