日期:2014-05-20 浏览次数:20649 次
package csdn;
/**
* Created by IntelliJ IDEA.
* User: haoshihai
* Date: 13-7-22
* Time: 下午12:03
* To change this template use File
------解决方案--------------------
Settings
------解决方案--------------------
File Templates.
*/
public class Tesk {
public String check(String str, int status, int level) {
System.out.println(str);
if (str.length() == 0) {
System.out.println("合法");
return null;
}
if(status==1){
level=level-1;
}
String index = str.substring(0, 1);
String last = str.substring(1);
int value = getStatus(index);
int codeLevel = getLevel(index);
if (status==0&&level>codeLevel) {
System.out.println("不合法");
} else {
check(last, value, codeLevel);//递归调用
}
return "null";