java base64加密和解密

    技术2022-08-01  76

    package test;

    import java.io.UnsupportedEncodingException; import java.util.*;

     

     

    public class base64 {

        public static void main(String[] args) {

            final Base64.Decoder decoder = Base64.getDecoder();         final Base64.Encoder encoder = Base64.getEncoder();         final String text = "602084";         //AOAG QTBBRw==         //101001 MTAxMDAx         byte[] textByte;         try {             textByte = text.getBytes("UTF-8");             //编码             final String encodedText = encoder.encodeToString(textByte);             System.out.println(encodedText);                          String s="MTAxMDAx";             System.out.println(new String(decoder.decode(encodedText), "UTF-8"));         } catch (UnsupportedEncodingException e) {             // TODO Auto-generated catch block             e.printStackTrace();         }                  String s="\'"+"dfdfd"+"\'";         System.out.println(s);         String loginId="123";     

        }          

     

     

    }  

    Processed: 0.014, SQL: 9