一、引入pom文件

<!-- https://mvnrepository.com/artifact/com.spreada/ZHConverter -->
<dependency>
    <groupId>com.spreada</groupId>
    <artifactId>ZHConverter</artifactId>
    <version>1.0.0</version>
</dependency>

 

二、转换方法

@Test
public class test{
    public static void main(String[] args) {
                ZHConverter converter = ZHConverter.getInstance(ZHConverter.SIMPLIFIED);
                //繁体转换简体
                String traditionalSrc = "放入繁体字符";
                String simplified = converter.convert(traditionalSrc);
                System.out.println(simplified);
                //简体转换繁体    
                String traditional = ZHConverter.convert(simplified,ZHConverter.TRADITIONAL);
                System.out.println(traditional);    
    }
}