add mothed
This commit is contained in:
+29
-7
@@ -1,12 +1,7 @@
|
||||
package com.fangjia.service.util;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class DataConvertUtil {
|
||||
public static String convert(Integer value){
|
||||
@@ -186,6 +181,33 @@ public class DataConvertUtil {
|
||||
ip[2] = Long.parseLong(strIp.substring(position2 + 1, position3));
|
||||
ip[3] = Long.parseLong(strIp.substring(position3 + 1));
|
||||
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