样式:010203040506
转换:01 02 03 04 05 06
//正则表达式 每两位数字加一个空格
public static String getFileAddSpace(String replace) {
String regex = "(.{2})";
replace = replace.replaceAll(regex, "$1 ");
return replace;
}
判断是否有重复
/**
* 看这里API文档注释:
* HashSet类,是存在于java.util包中的类抄[1]同时也被称为集合袭,该容器中只能存储不重复的知对象
*/
public static boolean checkRepeat(String[] array) {
Set set = new HashSet();
set.clear();
for (String str : array) {
set.add(str);
}
if (set.size() != array.length) {
return false;//有重复
} else {
return true;//不重复
}
}