-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMain.java
59 lines (58 loc) · 1.49 KB
/
Main.java
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
import java.util.Arrays;
import java.lang.reflect.Method;
import java.util.*;
public class Main {
/*static {
System.loadLibrary("heap");
}*/
public static void wait(int ms){
try{
Thread.sleep(ms);
}catch(InterruptedException ex){
Thread.currentThread().interrupt();
}
}
public static void count(int i, HashMap<Integer, String> map){
Integer k = Integer.valueOf(i);
String v = String.valueOf(i);
map.put(k,v);
//int[] arr = new int[100];
map.get(k);
}
public Integer loop(int m){
int total = 0;
HashMap<Integer, String> map = new HashMap<Integer, String>();
for (int i=0;i<m;i++){
count(i,map);
total +=i;
//if(i%100==0) wait(1);
wait(1);
}
return total;
}
public static void main(String[] args) throws Exception{
int size = Integer.parseInt(args[0]);
int count = Integer.parseInt(args[1]);
Main m = new Main();
Integer r = 0;
for (int i=0;i<count;i++){
r += m.loop(size);
}
System.out.println("Final result= "+r);
/*
String methodName = "toString";
try{
Method m = Object.class.getDeclaredMethod(methodName);
byte[] bytecode = getByteCodes(m);
System.out.println(Arrays.toString(bytecode));
}catch(NoSuchMethodException e){
System.out.println("No such method: "+methodName);
}catch(Error e){
e.printStackTrace();
}
*/
}
//public static native String getNativeString();
public static native int add(int a, int b);
private static int enabled = 0;
}