01: package method;
02:
03: public class ExtractMethod {
04: public void longMethod1() {
05: int last = 10;
06:
07: for (int ndx = 0; ndx < last; ndx++) {
08: if (ndx % 2 == 0) {
09: System.out.print("Even ");
10: } else {
11: System.out.print("Odd ");
12: }
13: System.out.println(ndx);
14: }
15: }
16:
17: public ExtractMethod(double init, String title) {
18: double start = init;
19: while (start < 1024) {
20: start *= 2;
21: System.out.println(" " + title + " " + start);
22: }
23:
24: name = title;
25: value = start;
26: }
27:
28: private String name;
29: private double value;
30: private int count;
31:
32: {
33: count = 0;
34: while (value > 1) {
35: value /= 2.0;
36: count++;
37: }
38: }
39: }
|