public class TestMap {
public static void main(String[] args) {
String str = "AAA+";
String str1 = "BBB+";
System.out.println(doAppraise("A", "AA")); // false
}
public static boolean doAppraise(String str, String str2) {
char[] appraiseMoody = splitString(str);
char[] appraiseLimit = splitString(str2);
boolean result = false;
result = bijiao(appraiseMoody, appraiseLimit);
return result;
}
public static boolean bijiao(char[] appraiseMoody, char[] appraiseLimit) {
char[] jia = "+".toCharArray();
char[] jian = "-".toCharArray();
int length = appraiseMoody.length;
int lengthLimit = appraiseLimit.length;
;
(((appraiseMoody[] == jia[]) || (appraiseMoody[] == jian[])) &&
((appraiseLimit[] == jia[]) || (appraiseLimit[] == jian[]))) {
result = shifouxiangt(appraiseMoody[], appraiseLimit[]);
} {
(appraiseMoody[] == appraiseLimit[]) {
(length == && lengthLimit == ) {
;
} (length == && lengthLimit > ) {
(appraiseLimit[] == jia[]) {
;
} {
;
}
} (length > && lengthLimit == ) {
(appraiseMoody[] == jia[]) {
;
} {
;
}
} {
(((appraiseMoody[] == jia[]) || (appraiseMoody[] == jian[])) &&
((appraiseLimit[] == jia[]) || (appraiseLimit[] == jian[]))) {
result = shifouxiangt(appraiseMoody[], appraiseLimit[]);
} {
(appraiseMoody[] == appraiseLimit[]) {
(length == && lengthLimit == ) {
;
} (length == && lengthLimit > ) {
(appraiseLimit[] == jia[]) {
;
} {
;
}
} (length > && lengthLimit == ) {
(appraiseMoody[] == jia[]) {
;
} (appraiseMoody[] >= && appraiseMoody[] <= appraiseMoody[]) {
;
} (appraiseMoody[] == jian[]) {
;
}
} {
(((appraiseMoody[] == jia[]) || (appraiseMoody[] == jian[])) &&
((appraiseLimit[] == jia[]) || (appraiseLimit[] == jian[]))) {
result = shifouxiangt(appraiseMoody[], appraiseLimit[]);
} {
(appraiseMoody[] == appraiseLimit[]) {
(length == && lengthLimit == ) {
;
} (length == && lengthLimit > ) {
(appraiseLimit[] == jia[]) {
;
} {
;
}
} (length > && lengthLimit == ) {
(appraiseMoody[] == jia[]) {
;
} {
;
}
} {
shifouxiangt(appraiseMoody[], appraiseLimit[]);
}
} (appraiseMoody[] < && appraiseMoody[] < appraiseLimit[]) {
;
} (appraiseMoody[] < && appraiseLimit[] < appraiseLimit[]) {
;
} (appraiseMoody[] < appraiseLimit[]) {
;
} {
;
}
}
}
} (appraiseMoody[] < appraiseLimit[]) {
;
} {
;
}
}
}
} (appraiseMoody[] < appraiseLimit[]) {
;
} {
;
}
}
result;
}
[] splitString(String str) {
str.toCharArray();
}
{
[] jia = .toCharArray();
[] jian = .toCharArray();
;
((a == jia[] && b == jia[]) || (a == jian[] && b == jian[])) {
result = ;
} ((a == jia[] && b == jian[]) || (a == jia[] && b != jian[])) {
result = ;
} {
result = ;
}
result;
}
}
Javajava算法
Java 自定义等级字符串比较逻辑分析
Java 自定义等级字符串比较逻辑通过字符数组拆分与逐位比对实现。方法包含长度判断及正负号处理,核心在于 bijiao 函数中的多层条件分支。代码中存在 shifouxiangt 返回值未赋值等潜在逻辑问题,需优化递归调用与边界条件检查以确保评级准确性。

