|
|
|
@ -5,34 +5,45 @@ import java.util.List; |
|
|
|
|
|
|
|
|
|
public class UserUtil { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 平均分配分值 |
|
|
|
|
* @param number 判分点数量 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static List<Integer> averageValue(Integer number) { |
|
|
|
|
Integer score=100/number; |
|
|
|
|
Integer lastScore=score+100%number; |
|
|
|
|
List<Integer> list=new ArrayList<Integer>(); |
|
|
|
|
for (int i = 0; i < number-1; i++) { |
|
|
|
|
list.add(score); |
|
|
|
|
} |
|
|
|
|
list.add(lastScore); |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 平均分配分值 |
|
|
|
|
* |
|
|
|
|
* @param number 判分点数量 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static List<Integer> averageValue(Integer number) { |
|
|
|
|
Integer score = 100 / number; |
|
|
|
|
List<Integer> list = new ArrayList<Integer>(); |
|
|
|
|
if (100 % number == 0) { |
|
|
|
|
for (int i = 0; i < number; i++) { |
|
|
|
|
list.add(score); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
int n = 0; |
|
|
|
|
for (int i = 0; i < number; i++) { |
|
|
|
|
list.add(score); |
|
|
|
|
} |
|
|
|
|
for (int i = 100 % number; i > 0; i--) { |
|
|
|
|
n = score + 1; |
|
|
|
|
list.set(i, n); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将string类型转成list集合 |
|
|
|
|
* @param str |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static List<Integer> strToInteger(String str){ |
|
|
|
|
String[] strs = str.split(","); |
|
|
|
|
List<Integer> list=new ArrayList<Integer>(); |
|
|
|
|
for (int i = 0; i < strs.length; i++) { |
|
|
|
|
list.add(Integer.parseInt(strs[i])); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 将string类型转成list集合 |
|
|
|
|
* |
|
|
|
|
* @param str |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static List<Integer> strToInteger(String str) { |
|
|
|
|
String[] strs = str.split(","); |
|
|
|
|
List<Integer> list = new ArrayList<Integer>(); |
|
|
|
|
for (int i = 0; i < strs.length; i++) { |
|
|
|
|
list.add(Integer.parseInt(strs[i])); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|