25,988
社区成员




package com.ninetech.be.web.action;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
public class Test1 {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
ByteArrayOutputStream bb1 = new ByteArrayOutputStream(4000000);
byte[] buf1 = new byte[1];
byte[] buf2 = new byte[2];
byte[] buf4 = new byte[4];
byte[] buf8 = mew bute[8];
int i = 0;
long s = System.currentTimeMillis();
while (i < 100000) {
bb1.write(buf1);
bb1.write(buf2);
bb1.write(buf4);
bb1.write(buf8);
bb1.write("测试字符串1号".getBytes()); // 不知道怎样强制变换写入ANSI...
bb1.write("测试字符串2号".getBytes());
i++;
}
long e = System.currentTimeMillis();
System.out.println("time: " + (e-s));
}
}