// 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) 
import java.math.BigInteger;
import java.security.SecureRandom;

public class AnotherSillyMicroBenchmark {
    private String bar;
    private static SecureRandom random = new SecureRandom();

    public String getBar() {
        return this.bar;
    }

    public void setBar(final String foo) {
        this.bar = foo;
    }

    public static String rand() {
        return new BigInteger(130, random).toString(32);
    }
    public static void main(final String[] args) {
        final AnotherSillyMicroBenchmark foo = new AnotherSillyMicroBenchmark();
        String tmp;
        long now = System.currentTimeMillis();
        for (int i = 0; i < 1000000; ++i) {
            foo.setBar(rand());
            tmp = foo.bar;
        }
        System.out.println(System.currentTimeMillis() - now);
        now = System.currentTimeMillis();
        for (int i = 0; i < 1000000; ++i) {
            foo.setBar(rand());
            tmp = foo.getBar();
        }
        System.out.println(System.currentTimeMillis() - now);
    }
}
