Using nanoTime and long to measure delay instead of int