自增长ID生成

11-03 1105人


public final class IdHandleUtil {

/* Don't let anyone instantiate this class */
private IdHandleUtil(){}

private static void inc(char[] str, int location) {
// exceptional case
if (str[location] == '9') {
str[location] = 'A';
} else if (str[location] == 'Z') {
str[location] = '0';
inc(str, location - 1);
} else if (str[location] == 'N') {
str[location] = 'P';
} else if (str[location] == 'H') {
str[location] = 'J';
} else {
// Conventional plus 1 operation
byte val = (byte) str[location];
val++;
str[location] = (char) val;
}
}

public static char[] id16StrInc(char[] id16Arr) {
inc(id16Arr, id16Arr.length - 1);
return id16Arr;
}

}



	
色迷迷 哭 呕吐 大笑 口水 微笑 啵一个 发怒

Hi,您需要填写昵称和邮箱!

  • 必填项
  • 必填项