import java.util.Base64;
private static String token = "";
byte[] bytes = token.getBytes();
Base64.Encoder encoder = Base64.getEncoder();
String encodeToken = encoder.encodeToString(bytes);
首先 先获取字符串的字节码数组,然后调用java.util.Base64 包下面的API
转完了还是用String接收