close
import java.util.Base64;
Base64.Decoder decoder = Base64.getDecoder();
Base64.Encoder encoder = Base64.getEncoder();
String text = "蘿莉萌";
byte[] textByte = text.getBytes("UTF-8");
//編碼
String encodedText = encoder.encodeToString(textByte);
System.out.println(encodedText);
//解碼
System.out.println(new String(decoder.decode(encodedText), "UTF-8"));
全站熱搜
留言列表