1 19 20 21 public class OptimizeTest { 22 23 public final int getInlined(String str, int i) { 24 return str.charAt(i); 25 } 26 27 public final int getInlined(String str, int i, OptimizeTest t) { 28 return str.charAt(i) + t.getInlined(str, i) + i; 29 } 30 31 32 public final int complexInline(String str, int i) { 33 System.err.println(""); 34 return str.charAt(i)+str.charAt(-i); 35 } 36 37 public int notInlined(String str, int i, OptimizeTest t) { 38 return str.charAt(i) + t.getInlined(str, i); 39 } 40 41 public final void longInline(String str, int i) { 42 str.replace('a','b'); 43 System.err.println(str.concat(String.valueOf(str.charAt(i)))); 44 } 45 46 public int g; 47 48 52 public final int sideInline(int a) { 53 return g++ + a; 54 } 55 56 public void main(String [] param) { 57 OptimizeTest ot = new OptimizeTest(); 58 59 System.err.println(ot.getInlined("abcde".replace('a','b'), param.length)); 60 System.err.println(ot.getInlined("Hallo", ot.notInlined(param[1], 10 - ot.getInlined(param[0], 0, new OptimizeTest()), ot))); 61 System.err.println(ot.complexInline("ollah", param.length)); 62 System.err.println("result: "+(g++ + sideInline(g) + g++) + "g: "+g); 63 longInline("Hallo", 3); 64 System.err.println("result:"+ 65 (g++ + InlineTest 66 .difficultSideInline(this, g) 67 + g++) + "g: "+g); 68 } 79 } 80 | Popular Tags |