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

    private static String createString()
    {
        String str = "";
        for (int i = 0; i < LOOP_COUNT; i++)
        {
            str += i + " ";
        }
        return str;
    }

    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 ***");
    }
}