view src/treecms/proto/test/StringConcatTest.java @ 50:a72718a0bccf

added demo tree builder
author shoshi
date Tue, 01 Feb 2011 16:28:49 +0900
parents 9d248304be96
children
line wrap: on
line source

package treecms.proto.test;

import java.nio.CharBuffer;

import org.junit.Test;
import org.junit.runner.JUnitCore;


public class StringConcatTest
{
	public static void main(String _args[])
	{
		JUnitCore.main(StringConcatTest.class.getName());
	}
	
	private String m_str = "123456789012345678901234567890";
	
	@Test
	public void testCharBuffer()
	{
		for(int j = 0;j < 1000;j ++){
			CharBuffer buffer = CharBuffer.allocate(1000*30);
			for(int i = 0;i < 1000;i ++){
				buffer.append(m_str);
			}
			System.out.println(new String(buffer.array()));
		}
	}
	
	@Test
	public void testStringBuffer()
	{
		for(int j = 0;j < 1000;j ++){
			StringBuffer tmp = new StringBuffer();
			for(int i = 0;i < 1000;i ++){
				tmp.append(m_str);
			}
		}
	}
	
	@Test
	public void testString()
	{
		for(int j = 0;j < 10;j ++){
			String tmp = "";
			for(int i = 0;i < 1000;i ++){
				tmp += m_str; //Iketenai!!!!
			}
		}
	}
}