add mothed
This commit is contained in:
+28
-6
@@ -1,12 +1,7 @@
|
|||||||
package com.fangjia.service.util;
|
package com.fangjia.service.util;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class DataConvertUtil {
|
public class DataConvertUtil {
|
||||||
public static String convert(Integer value){
|
public static String convert(Integer value){
|
||||||
@@ -188,4 +183,31 @@ public class DataConvertUtil {
|
|||||||
return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3];
|
return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//可以指定字符串的某个位置是什么范围的值
|
||||||
|
public static String getRandomString2(int length){
|
||||||
|
Random random=new Random();
|
||||||
|
StringBuffer sb=new StringBuffer();
|
||||||
|
for(int i=0;i<length;i++){
|
||||||
|
int number=random.nextInt(3);
|
||||||
|
long result=0;
|
||||||
|
switch(number){
|
||||||
|
case 0:
|
||||||
|
result=Math.round(Math.random()*25+65);
|
||||||
|
sb.append(String.valueOf((char)result));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result=Math.round(Math.random()*25+97);
|
||||||
|
sb.append(String.valueOf((char)result));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
sb.append(String.valueOf(new Random().nextInt(10)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user