-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbench.java
More file actions
28 lines (26 loc) · 937 Bytes
/
bench.java
File metadata and controls
28 lines (26 loc) · 937 Bytes
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
public class bench {
public static void main(String[] args){
Map test = new Map("trains.csv");
int k = 1;
for(int i = 0; i < 541; i++){
if(test.cities[i] != null){
System.out.print("City nr " + k + " : " + test.cities[i].cityName + " connects to ");
for(int j = 0; j < 5; j++){
if(test.cities[i].connections[j] != null){
System.out.print(test.cities[i].connections[j].City.cityName + ", ");
}
}
System.out.println();
k++;
}
}
int hash = 7;
int mod = 541;
String name = "Borlänge";
for (int i = 0; i < name.length(); i++) {
hash = (hash * 31 % mod) + name.charAt(i);
}
System.out.println(hash % mod);
System.out.println(test.cities[3].cityName);
}
}