用BCEL筹划字节码 - 直接在原办法上加指令[Java编程]
本文“用BCEL筹划字节码 - 直接在原办法上加指令[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
前一个是直接生成了一个一个办法对原办法举行调用,目前直接在原办法上举行改正
行将
public class StringBuilder
{
private String buildString(int length) {
String result = "";
for (int i = 0; i < length; i++) {
result += (char)(i%26 + 'a');
}
System.out.println(result);
return result;
}
public static void main(String[] argv) {
StringBuilder inst = new StringBuilder();
for (int i = 0; i < argv.length; i++) {
String result = inst.buildString(Integer.parseInt(argv[i]));
System.out.println("Constructed string of length " +
result.length());
}
}
}
改成:
public class StringBuilder
{
private String buildString(int length) {
System.out.println("start start start");
long starttime = System.currentTimeMillis();
String result = "";
for (int i = 0; i < length; i++) {
result += (char)(i%26 + 'a');
}
System.out.println(result);
System.out.println("Call to buildString$impl took " +
(System.currentTimeMillis()-starttime) + " ms.");
System.out.println("end end end end");
return result;
}
public static void main(String[] argv) {
StringBuilder inst = new StringBuilder();
for (int i = 0; i < argv.length; i++) {
String result = inst.buildString(Integer.parseInt(argv[i]));
System.out.println("Constructed string of length " +
result.length());
}
}
}
以上是“用BCEL筹划字节码 - 直接在原办法上加指令[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |