liurunyu
2023-11-27 c475f9ad3290c2593897736144758b54e2b2f407
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.dy.testClient.httpCl;
 
import java.io.UnsupportedEncodingException;
import java.util.Base64;
 
import com.dy.common.util.ByteUtil;
 
public class TestBase64 {
 
    public static void main(String[] args) throws UnsupportedEncodingException{
        String hex1 = "6838363235393230353934333439373000002002303231310000000000000032003005002E000000000001000000000200000000032101010012330400300521010100123306016907016908000009FF0000FC16" ;
        System.out.println(hex1);
        byte[] bs = ByteUtil.hex2Bytes(hex1) ;
        bs = Base64.getEncoder().encode(bs) ;
        String base64 = new String(bs, "UTF-8") ;
        System.out.println(base64);
        
        bs = Base64.getDecoder().decode(base64);
        String hex2 = ByteUtil.bytes2Hex(bs, false) ;
        System.out.println(hex2);
 
    }
}