Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Convert base64 string to a byte array

public class Main {   public static void main(String[] argv) throws Exception {     byte[] buf = new byte[] { 0x12, 0x23 };     String s = new sun.misc.BASE64Encoder().encode(buf);     buf = new sun.misc.BASE64Decoder().decodeBuffer(s);   } }