Base64 String to byte[] in java [duplicate]
You can use java.util.Base64 package to decode the String to byte[]. Below code which I have used for encode and decode. For Java 8 : import java.io.UnsupportedEncodingException; import java.util.Base64; public class Example { public static void main(String[] args) { try { byte[] name = Base64.getEncoder().encode(“hello World”.getBytes()); byte[] decodedString = Base64.getDecoder().decode(new String(name).getBytes(“UTF-8”)); System.out.println(new String(decodedString)); } catch … Read more