/**
* @author lautturi.com
* Java example: base64 encode/decode example
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
String str = "lautturi java";
byte[] encoder = Base64.getEncoder().encode(str.getBytes());
String b64 = new String(encoder);
System.out.println(b64);
byte[] decoder = Base64.getDecoder().decode(b64);
String str2 = new String(decoder);
System.out.println(str2);
}
}Source:wwttual.wuri.comoutput:
bGF1dHR1cmkgamF2YQ== lautturi java