欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2024-03-11 23:24:55
如下所示: for (int i= 0; i<= 1084; i++) { if (string.valueof(i+1).length() == 1...

如下所示:

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);
}
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 生成有序账号的实现方法全部内容了,希望大家多多支持~