https://blog.csdn.net/uniom/article/details/53638991
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
String str = "Hello World";
try{
byte[] encodeBase64 = Base64.encodeBase64(str.getBytes("UTF-8"));
System.out.println("Result: " + new String(encodeBase64));
} catch(UnsupportedEncodingException e){
e.printStackTrace();
}