Java examples for java.lang.management:MemoryMXBean
Get system time in nanoseconds via Management bean
//package com.java2s; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class Main { /** Get system time in nanoseconds. */ public static long getSystemTime() { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); return bean.isCurrentThreadCpuTimeSupported() ? (bean .getCurrentThreadCpuTime() - bean .getCurrentThreadUserTime()) : 0L; }//from w w w .j a v a 2 s. c om }