// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class SBSB {
    private static String sb1(String s1, String s2) {
        StringBuffer sb = new StringBuffer();
        sb.append(s1);
        sb.append(s2);
        return sb.toString();
    }
    private static String sb2(String s1, String s2) {
        StringBuilder sb = new StringBuilder();
        sb.append(s1);
        sb.append(s2);
        return sb.toString();
    }
    private final static int N = 100000000;
    private static void test1() {
        long t1 = System.currentTimeMillis();
        for(int i = 0; i < N; i++) {
            sb1("ABC", "DEF");
        }
        long t2 = System.currentTimeMillis();
        System.out.println(t2 - t1);
    }
    private static void test2() {
        long t1 = System.currentTimeMillis();
        for(int i = 0; i < N; i++) {
            sb2("ABC", "DEF");
        }
        long t2 = System.currentTimeMillis();
        System.out.println(t2 - t1);
    }
    public static void main(String[] args) {
        test1();
        test2();
        test1();
        test2();
        test1();
        test2();
    }
}
