All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.polaris.core.time.Times Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.time;

/**
 * @author Qt
 * @since 1.8
 */
public class Times {

	public static long nanoTime(int repeat, Runnable runnable) {
		long start = System.nanoTime();
		for (int i = 0; i < repeat; i++) {
			runnable.run();
		}
		return System.nanoTime() - start;
	}

	public static long millsTime(int repeat, Runnable runnable) {
		return nanoTime(repeat, runnable) / 1000000;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy