- package com.DataSource;
- public class TestMain {
- public static void main(String arg[]){
- TestMain tes=new TestMain();
- String s="a";
- for(int i=0;i<1000;i++){
- s=tes.addoneletters(s);
- System.out.println(s);
- }
- // String n="0";
- // for(int i=0;i<5555;i++){
- // n=tes.addone(n);
- // System.out.println(n+"");
- // }
- }
- public String addone(String strings){
- int length=strings.length();
- char[] c=new char[length];
- boolean ifzzzz=true;//表示全部为zzzz的字符串
- for(int i=0;i<length;i++){
- char tmp=strings.charAt(i);
- if(tmp!="z".charAt(0)){
- ifzzzz=false;
- }
- c[i]=tmp;
- }
- if(ifzzzz){
- strings="1"+strings.replace("z", "0");
- return strings;
- }
- boolean carry=true;//标识是否有进位
- int p=length;
- while(carry){
- p--;
- char added=this.addone(c[p]);
- if(added=="0".charAt(0)){
- c[p]=added;
- carry=true;
- }else{
- c[p]=added;
- carry=false;
- }
- }
- strings=new String(c);
- return strings;
- }
- public char addone(char chars){
- if((chars<123&&96<chars)||(47<chars&&chars<58)){
- if(chars==122){
- chars=48;
- }else if(chars==57){
- chars+=40;
- }else {
- chars++;
- }
- }else{
- }
- return chars;
- }
- public String addoneletters(String strings){
- int length=strings.length();
- char[] c=new char[length];
- boolean ifzzzz=true;//表示全部为zzzz的字符串
- for(int i=0;i<length;i++){
- char tmp=strings.charAt(i);
- if(tmp!="z".charAt(0)){
- ifzzzz=false;
- }
- c[i]=tmp;
- }
- if(ifzzzz){
- strings="a"+strings.replace("z", "a");
- return strings;
- }
- boolean carry=true;//标识是否有进位
- int p=length;
- while(carry){
- p--;
- char added=this.addoneletters(c[p]);
- if(added=="a".charAt(0)){
- c[p]=added;
- carry=true;
- }else{
- c[p]=added;
- carry=false;
- }
- }
- strings=new String(c);
- return strings;
- }
- public char addoneletters(char chars){
- if((chars<123&&95<chars)||(47<chars&&chars<58)){
- if(chars==122){
- chars=97;
- }
- else {
- chars++;
- }
- }else{
- }
- return chars;
- }
- }