@@ -0,0 +1,1254 @@
+package others.algorithm;%0A%0Aimport org.junit.jupiter.api.Assertions;%0Aimport org.junit.jupiter.api.Test;%0A%0A/**%0A */%0Apublic class NumToChinese %7B%0A%0A    @Test%0A    void test() %7B%0A        Assertions.assertEquals(%22%E5%8D%81%E4%BA%94%E4%BA%BF%E9%9B%B6%E4%B8%80%E5%8D%83%E9%9B%B6%E4%B8%89%22, numToChinese(1500001003));%0A        Assertions.assertEquals(%22%E5%8D%81%E4%BA%94%E4%BA%BF%E4%B8%83%E5%8D%83%E5%85%AB%E7%99%BE%E4%B9%9D%E5%8D%81%E4%B8%87%E9%9B%B6%E5%9B%9B%E7%99%BE%E9%9B%B6%E4%B8%89%22, numToChinese(1578900403));%0A    %7D%0A%0A    // In Chinese, 10,100,1000,10000 are all base cases. %E5%8D%81 is special case.%0A    private String numToChinese(int num) %7B%0A        String%5B%5D ones = %22 %E4%B8%80 %E4%BA%8C %E4%B8%89 %E5%9B%9B %E4%BA%94 %E5%85%AD %E4%B8%83 %E5%85%AB %E4%B9%9D%22.split(%22 %22);%0A        String%5B%5D tens = %22 %E5%8D%81 %E4%BA%8C%E5%8D%81 %E4%B8%89%E5%8D%81 %E5%9B%9B%E5%8D%81 %E4%BA%94%E5%8D%81 %E5%85%AD%E5%8D%81 %E4%B8%83%E5%8D%81 %E5%85%AB%E5%8D%81 %E4%B9%9D%E5%8D%81%22.split(%22 %22);%0A        if (num %3C 10) return ones%5Bnum%5D;%0A        else if (num %3C 100) return tens%5Bnum / 10%5D + numToChinese(num %25 10);%0A        else if (num %3C 1000) return ones%5Bnum / 100%5D + %22%E7%99%BE%22%0A                + (num %25 100 %3C 10 ? %22%E9%9B%B6%22 : %22%22) + numToChinese(num %25 100);%0A        else if (num %3C 10000) return ones%5Bnum / 1000%5D + %22%E5%8D%83%22%0A                + (num %25 1000 %3C 100 ? %22%E9%9B%B6%22 : %22%22) + numToChinese(num %25 1000);%0A        else if (num %3C 100000000) return numToChinese(num / 10000) + %22%E4%B8%87%22%0A                + (num %25 10000 %3C 1000 ? %22%E9%9B%B6%22 : %22%22) + numToChinese(num %25 10000);%0A        else return numToChinese(num / 100000000) + %22%E4%BA%BF%22%0A                + (num %25 100000000 %3C 10000 ? %22%E9%9B%B6%22 : %22%22) + numToChinese(num %25 100000000);%0A    %7D%0A%0A%7D%0A

Amazon number to Chinese numeral