public class ConcatTest3
{
    private static final int LOOP_COUNT = 10000;

    private static String createString()
    {
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < LOOP_COUNT; i++)
        {
            str.append(i);
            str.append(' ');
        }
        return str.toString();
    }

    public static void main(String[] args)
    {
        String str = createString();
        System.out.println("String length: " + str.length());
        System.out.println("*** Running full gc ***");
        System.gc();
        System.runFinalization();
        System.out.println("*** Quitting ***");
    }
}