首页 > 代码库 > 统计JAVA程序运行时间

统计JAVA程序运行时间

import java.net.InetAddress;import java.net.UnknownHostException;public class StatisticsTimes {    public static void main(String[] args) {                long time = System.currentTimeMillis();                InetAddress[] addresses = null;        try {            addresses = InetAddress.getAllByName("www.baidu.com");        } catch (UnknownHostException e) {            e.printStackTrace();        }                System.out.println(String.valueOf(System.currentTimeMillis() - time) + "ms");                for(InetAddress address : addresses) {                        System.out.println(address);        }    }}

 

统计JAVA程序运行时间