1 package test4; 2 3 public class GapSwitch { 4 public int value; foo(int i)5 public int foo(int i) { return i + 1; } run()6 public int run() { 7 value = 0; 8 int k = 0; 9 k = foo(k); 10 switch (value) { 11 case 0: 12 k++; 13 break; 14 case 1: 15 k *= 10; 16 break; 17 default: 18 k *= 100; 19 break; 20 } 21 22 return k + value * 1000; 23 } 24 run2()25 public int run2() { 26 value = 0; 27 int k = 0; 28 k = foo(k); 29 switch (value) { 30 case 10: 31 k++; 32 break; 33 case 1300: 34 k *= 10; 35 break; 36 default: 37 k *= 100; 38 break; 39 } 40 41 return k + value * 1000; 42 } 43 run3()44 public int run3() { 45 value = 1; 46 int k = 0; 47 for (int i = 0; i < 2; i++) { 48 k = foo(k); 49 switch (value) { 50 case 10: 51 k++; 52 k = foo(k); 53 break; 54 case 1300: 55 k *= 100; 56 k = foo(k); 57 break; 58 default: 59 k *= 10; 60 k = foo(k); 61 break; 62 } 63 64 k = foo(k); 65 switch (value) { 66 case 10: 67 k++; 68 k = foo(k); 69 break; 70 case 13: 71 k *= 100; 72 k = foo(k); 73 break; 74 default: 75 k *= 10; 76 k = foo(k); 77 break; 78 } 79 } 80 81 return k + value; 82 } 83 } 84