随机生成 imsi imei mac

随机生成 imsi imei machttp://blog.csdn.net/argonwu/article/details/42971909privatestaticStringgetIMEI(){//calculatorIMEIintr1=1000000+newjava.util.Random().nextInt(9000000);intr2=1000000+

大家好,欢迎来到IT知识分享网。随机生成 imsi imei mac

http://blog.csdn.net/argonwu/article/details/42971909

private static String getIMEI() {// calculator IMEI

int r1 = 1000000 + new java.util.Random().nextInt(9000000);


int r2 = 1000000 + new java.util.Random().nextInt(9000000);


String input = r1 + “” + r2;


char[] ch = input.toCharArray();


int a = 0, b = 0;


for (int i = 0; i < ch.length; i++) {


int tt = Integer.parseInt(ch[i] + “”);


if (i % 2 == 0) {


a = a + tt;


} else {


int temp = tt * 2;


b = b + temp / 10 + temp % 10;


}


}


int last = (a + b) % 10;


if (last == 0) {


last = 0;


} else {


last = 10 – last;


}


return input + last;


}


private static String getImsi() {


// 460022535025034


String title = “4600”;


int second = 0;


do {


second = new java.util.Random().nextInt(8);


} while (second == 4);


int r1 = 10000 + new java.util.Random().nextInt(90000);


int r2 = 10000 + new java.util.Random().nextInt(90000);


return title + “” + second + “” + r1 + “” + r2;


}


private static String getMac(){


char[] char1 = “abcdef”.toCharArray();


char[] char2 = “0123456789”.toCharArray();


StringBuffer mBuffer = new StringBuffer();


for (int i = 0; i < 6; i++) {


int t = new java.util.Random().nextInt(char1.length);


int y = new java.util.Random().nextInt(char2.length);


int key = new java.util.Random().nextInt(2);


if (key ==0) {


mBuffer.append(char2[y]).append(char1[t]);


}else {


mBuffer.append(char1[t]).append(char2[y]);


}





if (i!=5) {


mBuffer.append(“:”);


}


}


return mBuffer.toString();


}

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/15156.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信