import java.util.Base64;
// Java中的Base64编码和解码
class Main
{
public static void main(String[] args)
{
String string = "Techie Delight";
// 使用 `Base64` 编码器对字符串进行编码
Base64.Encoder encoder = Base64.getEncoder();
String encoded = encoder.encodeToString(string.getBytes());
System.out.println("Encoded Data: " + encoded);
// 解码编码数据
Base64.Decoder decoder = Base64.getDecoder();
String decoded = new String(decoder.decode(encoded));
System.out.println("Decoded Data: " + decoded);
}
}