KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Looper


1 /**
2  * Looper
3  *
4  * This has a Loop in it.
5  *
6  * @author < a HREF="ddp@apache.org">David Dixon-Peugh</a>
7  */

8
9 public class Looper implements org.quilt.cl.RunTest {
10     
11     public Looper() { }
12     public static int I = -10;
13     
14     public void doSomething( int i ) {
15         I += i;
16     }
17
18     public void doSomethingElse( int i ) {
19         I *= i;
20     }
21
22     public int runTest(int x) {
23         int i;
24         for (i = 0; i < 10; i++) {
25             doSomething( i );
26         }
27
28         while (i > 0) {
29             doSomethingElse( i );
30             i--;
31         }
32         return I;
33     }
34 }
35
Popular Tags