1
13693261870
2022-09-16 fee60c3e25fac0982f3b8cb8feea7225c4ed22f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.terra.proxy.util;
 
public class CrpUtil {
    
 
    private static char[] codes={'a','b','c','d','e','f','g','h','i','j','h'};
 
    
    public static String encode(Integer num){
        String temp= num.toString();
        char[] b=temp.toCharArray();
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < b.length; i++) {
             int t= b[i]-'0';
            sb.append(codes[t]);
        }
        
        return sb.toString();
    }
 
    
    public static Integer decode(String str){
        
        char[] b=str.toCharArray();
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < b.length; i++) {
             for(int j=0; j< codes.length;j++ ){
                 if(b[i]==codes[j]){
                     sb.append(j);
                 }
             }
               
        }
        
        return Integer.valueOf(sb.toString());
    }
 
}