import java.util.Base64; public class Base64Example { public static void main(String[] args) { String text = "Hello, Base64!"; byte[] encodedBytes = Base64.getEncoder().encode(text.getBytes()); String encodedText = new String(encodedBytes); System.out.println("Encoded Text: " + encodedText); byte[] decodedBytes = Base64.getDecoder().decode(encodedBytes); String decodedText = new String(decodedBytes); System.out.println("Decoded Text: " + decodedText); } }


上一篇:
下一篇:
切换中文