java自带的Base64

//加密

String encodeToString = Base64.getEncoder().encodeToString(password.getBytes());

System.out.println(encodeToString);

//解码

        byte[] decode = Base64.getDecoder().decode(encodeToString);

System.out.println(new String(decode));

你可能感兴趣的:(java自带的Base64)