java 生成有序账号的实现方法

时间:2022-08-30 08:40:35

如下所示:

java" id="highlighter_855907">
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
for (int i= 0; i<= 1084; i++) {
 
if (String.valueOf(i+1).length() == 1) {
username = "sys_000" + (i+1);
}
if (String.valueOf(i+1).length() == 2) {
username = "sys_00" + (i+1);
}
if (String.valueOf(i+1).length() == 3) {
username = "sys_0" + (i+1);
}
if (String.valueOf(i+1).length() == 4) {
username = "sys_" + (i+1);
}
System.out.println(username);
}
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
sys_0001
sys_0002
sys_0003
sys_0004
sys_0005
sys_0006
sys_0007
sys_0008
sys_0009
sys_0010
sys_0011
sys_0012
sys_0013
sys_0014
sys_0015
sys_0016
sys_0017
sys_0018
sys_0019
sys_0020
sys_0021
sys_0022
sys_0023
sys_0024
sys_0025
sys_0026
sys_0027
sys_0028
sys_0029
sys_0030
sys_0031
sys_0032
sys_0033
sys_0034
sys_0035
sys_0036

以上就是小编为大家带来的java 生成有序账号的实现方法全部内容了,希望大家多多支持服务器之家~