import java.util.Vector;

public class SizeTest
{
    public static void main(String[] args)
        throws Exception
    {
        String s = new String("1");
        System.out.println("String: " + s.getBytes("ISO-8859-1").length);

        String[] encoder = new String[999999];
        System.out.println("String[] length: " + encoder.length);

        for (int i = 0; i < encoder.length; i++)
        {
            ;
        }

        int length = encoder.length;
        long start = System.currentTimeMillis();
        for (int i = 0; i < length; i++)
        {
            ;
        }
        System.out.println("Time: " + String.valueOf(System.currentTimeMillis() - start));

        start = System.currentTimeMillis();
        for (int i = 0; i < encoder.length; i++)
        {
            ;
        }
        System.out.println("Time: " + String.valueOf(System.currentTimeMillis() - start));


        Vector v;
        v = new Vector(9999999);
        v.add(new Object());
        start = System.currentTimeMillis();
        for (int i = 0; i < v.size(); i++)
        {
            ;
        }
        System.out.println("V1 Time: " + String.valueOf(System.currentTimeMillis() - start));

        int size = v.size();
        start = System.currentTimeMillis();
        for (int i = 0; i < size; i++)
        {
            ;
        }
        System.out.println("V2 Time: " + String.valueOf(System.currentTimeMillis() - start));


        StringBuffer sb = new StringBuffer(1000);
        for (int i = 0; i < 1000; i++)
        {
            sb.append("X");
        }
        String str = sb.toString();
        start = System.currentTimeMillis();
        for (int i = 0; i < 999999; i++)
        {
            str.length();
            str.length();
        }
        System.out.println("L1 Time: " + String.valueOf(System.currentTimeMillis() - start));

        start = System.currentTimeMillis();
        for (int i = 0; i < 999999; i++)
        {
            str.length();
        }
        System.out.println("L2 Time: " + String.valueOf(System.currentTimeMillis() - start));
    }
}
