@Setup(Level.Trial)
    public void setUp() {
        for (int i = 0; i < DISTINCT_KEYS; ++i) {
            keys[i] = KEY + i;
            values[i] = VALUE + i;
        }
        lruCache = new LRUCache<>(100);
    }
This is a simple example of a JMH benchmark.

The sample code provided by the JMH project is a great place to start learning how to write correct benchmarks:
http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/cache/LRUCacheBenchmark.java