AAA.java
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.bootdo.common.utils;
import java.util.HashMap;
import java.util.Map;
public class AAA {
public static void main(String[] args) {
//map打印
Map<String,Object> map = new HashMap<String,Object>();
map.put("name", "zhangsan");
map.put("age", 21);
for(int i=0;i<20;i++) {
map.put(String.valueOf(i), i+"aa");
}
System.out.println(map.toString());
Map<String,Object> map2 = new HashMap<String, Object>();
map2.put("ss", map.toString());
System.out.println(map2.get("ss"));
System.out.println("13".hashCode());
System.out.println("14".hashCode());
int hash = 0;
char value[] = {'1','4'};
int h = hash;
if (h == 0 && value.length > 0) {
char val[] = value;
for (int i = 0; i < value.length; i++) {
h = 31 * h + val[i];
}
hash = h;
}
System.out.println(h);
char value2[] = {'4','1'};
int h2 = hash;
if (h2 == 0 && value2.length > 0) {
char val[] = value2;
for (int i = 0; i < value2.length; i++) {
h2 = 31 * h2 + val[i];
}
hash = h2;
}
System.out.println(h2);
System.out.println("14".hashCode());
System.out.println("41".hashCode());
}
}