public int hashCode() {
int h = hash;
if (h == 0) {
int off = offset;
char val[] = value;
int len = count;
for (int i = 0; i < len; i++) {
h = 31*h + val[off++];
}
hash = h;
}
return h;
}
import java.util.HashMap;
public class Test {
static HashMap map = new HashMap();
private static char startChar = 'A';
private static char endChar = 'z';
private static int offset = endChar - startChar + 1;
private static int dup = 0;
public static void main(String[] args) {
int len = 3;
char[] chars = new char[len];
tryBit(chars, len);
System.out.println((int)Math.pow(offset, len) + ":" + dup);
}
private static void tryBit(char[] chars, int i) {
for (char j = startChar; j <= endChar; j++) {
chars[i - 1] = j;
if (i > 1)
tryBit(chars, i - 1);
else
test(chars);
}
}
private static void test(char[] chars) {
String str = new String(chars).replaceAll("[^a-zA-Z_]", "").toUpperCase();// 195112:0
//String str = new String(chars).toLowerCase();//195112:6612
//String str = new String(chars).replaceAll("[^a-zA-Z_]","");//195112:122500
//String str = new String(chars);//195112:138510
int hash = str.hashCode();
if (map.containsKey(hash)) {
String s = (String) map.get(hash);
if (!s.equals(str)) {
dup++;
System.out.println(s + ":" + str);
}
} else {
map.put(hash, str);
// System.out.println(str);
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有