/*** The last two generation rules of the sending terminal number can generate (36*36-1) 1295 numbers * 01... 09 0a... 0z * 10... 19 1A... 1z *............... * A0... a9 aa... AZ *............... * z0... z9 Za... ZZ */Public String generatenumber (string number) {string ret = number. substring (0, number. length ()-2); // obtain the first half of the number = number. substring (number. length ()-2); // take the last two digits // take the first character char character = number. charat (0); char CH2 = number. charat (1); // generate the second string if (number. equals ("ZZ") {// reaches the upper limit ZZ. return NULL is not generated using the generation rule.} If (CH2 <'Z ') {// The next letter of 9 is a if (CH2 = '9') {CH2 = 'a';} else {CH2 + = 1 ;} ret = RET + "" + cursor + CH2;} else {// Add 1 to the first character; 0 to the second if (then = '9 ') {response = 'a';} else {response + = 1;} ret = RET + "" + response + 0;} return ret ;}
public static void main(String[] args){ String[] arr={"01","09","0A","0Y","0Z","90","99","9B","9Z","A0","AZ","Z0","ZY","ZZ"}; for(String arr1:arr){ System.out.println("--->:"+test(arr1)); } }
Use ASCII code to generate a string of a specified rule