equal
deleted
inserted
replaced
11 .method public static write(I)V |
11 .method public static write(I)V |
12 .limit locals 1 |
12 .limit locals 1 |
13 .limit stack 2 |
13 .limit stack 2 |
14 getstatic java/lang/System/out Ljava/io/PrintStream; |
14 getstatic java/lang/System/out Ljava/io/PrintStream; |
15 iload 0 |
15 iload 0 |
16 i2c |
16 invokevirtual java/io/PrintStream/println(I)V |
17 invokevirtual java/io/PrintStream/print(C)V |
|
18 return |
17 return |
|
18 .end method |
|
19 |
|
20 .method public static writes(Ljava/lang/String;)V |
|
21 .limit stack 2 |
|
22 .limit locals 1 |
|
23 getstatic java/lang/System/out Ljava/io/PrintStream; |
|
24 aload 0 |
|
25 invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V |
|
26 return |
|
27 .end method |
|
28 |
|
29 .method public static read()I |
|
30 .limit locals 10 |
|
31 .limit stack 10 |
|
32 |
|
33 ldc 0 |
|
34 istore 1 ; this will hold our final integer |
|
35 |
|
36 Label1: |
|
37 getstatic java/lang/System/in Ljava/io/InputStream; |
|
38 invokevirtual java/io/InputStream/read()I |
|
39 istore 2 |
|
40 iload 2 |
|
41 ldc 10 ; the newline delimiter |
|
42 isub |
|
43 ifeq Label2 |
|
44 iload 2 |
|
45 ldc 32 ; the space delimiter |
|
46 isub |
|
47 ifeq Label2 |
|
48 |
|
49 iload 2 |
|
50 ldc 48 ; we have our digit in ASCII, have to subtract it from 48 |
|
51 isub |
|
52 ldc 10 |
|
53 iload 1 |
|
54 imul |
|
55 iadd |
|
56 istore 1 |
|
57 goto Label2 |
|
58 goto Label1 |
|
59 |
|
60 Label2: |
|
61 iload 1 ; when we come here we have our integer computed in local variable 1 |
|
62 ireturn |
19 .end method |
63 .end method |
20 |
64 |
21 .method public static main([Ljava/lang/String;)V |
65 .method public static main([Ljava/lang/String;)V |
22 .limit locals 200 |
66 .limit locals 200 |
23 .limit stack 200 |
67 .limit stack 200 |