package com.sf._01_encoding;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class Test {
    public static void main(String[] args) throws UnsupportedEncodingException {
        /**
         * 编码: str.getBytes(编码规则);   把字符串转成字节数组  十进制字节数组
         * 解码: new String(byte[] , 解码规则)
         */
        String str = "abac中";
        byte[] bytes = str.getBytes("UTF-8");
        System.out.println(Arrays.toString(bytes));

        String str1 = new String(bytes,"GBK");
        System.out.println(str1);
    }
}
