Here you can find the source of decodeBase64(String base64Data)
public static byte[] decodeBase64(String base64Data)
//package com.java2s; //License from project: Apache License import sun.misc.BASE64Decoder; import java.io.*; public class Main { public static byte[] decodeBase64(String base64Data) { try {/*from ww w . j a v a2s. c o m*/ return new BASE64Decoder().decodeBuffer(base64Pad(base64Data)); } catch (IOException e) { throw new RuntimeException(e); } } /** * Pads a given String s to be usable for BASE64Decoder (if it isn't padded the resulting deoceded data may be wrong) * @param s * @return */ public static String base64Pad(String s) { int toPad = s.length() % 4; for (int i = 0; i < toPad; ++i) { s = s + "="; } return s; } }