package pack;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class OSDetails {
public static void main(String[] args) throws InterruptedException {
DateFormat dateFormat = new SimpleDateFormat();
Date date = new Date();
System.out.println(dateFormat.format(date).substring(0,7));
System.out.println("OS Name: "+ System.getProperty("os.name"));
System.out.println("OS Version: "+ System.getProperty("os.version"));
System.out.println("OS Arch: "+ System.getProperty("os.arch"));
System.out.println("Host: "+ System.getProperty("hostname"));
System.out.println("user.home: "+ System.getProperty("user.home"));
System.out.println("user.name: "+ System.getProperty("user.name"));
System.out.println("path.separator: "+ System.getProperty("path.separator"));
System.out.println("user.dir: "+ System.getProperty("user.dir"));
long i1= System.currentTimeMillis();
Thread.sleep(10000);
long i2= System.currentTimeMillis();
System.out.println("Elapsed time in milli seconds: "+ (i2-i1));
System.out.println("Elapsed time in seconds: "+ TimeUnit.MILLISECONDS.toSeconds(i2-i1));
}
}
/* Output:
7/10/14
OS Name: Windows 7
OS Version: 6.1
OS Arch: amd64
Host: null
user.home: C:\Users\IN00739
user.name: IN00739
path.separator: ;
user.dir: C:\Users\IN00739\workspace\RnD
Elapsed time in milli seconds: 10001
Elapsed time in seconds: 10
*/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class OSDetails {
public static void main(String[] args) throws InterruptedException {
DateFormat dateFormat = new SimpleDateFormat();
Date date = new Date();
System.out.println(dateFormat.format(date).substring(0,7));
System.out.println("OS Name: "+ System.getProperty("os.name"));
System.out.println("OS Version: "+ System.getProperty("os.version"));
System.out.println("OS Arch: "+ System.getProperty("os.arch"));
System.out.println("Host: "+ System.getProperty("hostname"));
System.out.println("user.home: "+ System.getProperty("user.home"));
System.out.println("user.name: "+ System.getProperty("user.name"));
System.out.println("path.separator: "+ System.getProperty("path.separator"));
System.out.println("user.dir: "+ System.getProperty("user.dir"));
long i1= System.currentTimeMillis();
Thread.sleep(10000);
long i2= System.currentTimeMillis();
System.out.println("Elapsed time in milli seconds: "+ (i2-i1));
System.out.println("Elapsed time in seconds: "+ TimeUnit.MILLISECONDS.toSeconds(i2-i1));
}
}
/* Output:
7/10/14
OS Name: Windows 7
OS Version: 6.1
OS Arch: amd64
Host: null
user.home: C:\Users\IN00739
user.name: IN00739
path.separator: ;
user.dir: C:\Users\IN00739\workspace\RnD
Elapsed time in milli seconds: 10001
Elapsed time in seconds: 10
No comments:
Post a Comment