UI 2 éve
szülő
commit
e86b9327cf

+ 4 - 18
README.md

@@ -1,18 +1,4 @@
-## Getting Started
-
-Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
-
-## Folder Structure
-
-The workspace contains two folders by default, where:
-
-- `src`: the folder to maintain sources
-- `lib`: the folder to maintain dependencies
-
-Meanwhile, the compiled output files will be generated in the `bin` folder by default.
-
-> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
-
-## Dependency Management
-
-The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
+自动生成200个数组元素
+* currentTime 精确到纳秒 
+* ms 精确到毫秒 
+* TEST 时间戳测试

+ 0 - 8
src/com/example/currentTime.java

@@ -1,6 +1,5 @@
 package com.example;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Random;
 
@@ -11,21 +10,14 @@ public class currentTime{
      * 测试时间戳类
      */
     public static void main(String[] args) {
-        ArrayList<Integer> arrayList = new ArrayList<>();
         long start = System.currentTimeMillis(); 
         System.out.println("开始时间:"+start);
         try {
             Thread.sleep(5000); 
-            Random random = new Random();
-            for (int i = 0; i <= 20; i++) {
-                // 循环,生成随机数
-                arrayList.add(random.nextInt(20) + 1);
-            }
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
         long end = System.currentTimeMillis(); 
         System.out.println(end - start+"毫秒"); 
     }
-
 }

+ 2 - 5
src/com/example/ms.java

@@ -1,9 +1,6 @@
 package com.example;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.Random;
 
 public class ms {
@@ -15,8 +12,8 @@ public class ms {
         try {
              Thread.sleep(0); //线程休眠
             Random random = new Random();
-            for (int i = 0; i <= 5; i++) {
-                arrayList.add(random.nextInt(5) + 1);
+            for (int i = 0; i <= 10; i++) {
+                arrayList.add(random.nextInt(0) + 1);
             }
         } catch (InterruptedException e) {
             e.printStackTrace();

+ 2 - 5
src/com/example/nanosecond.java

@@ -1,9 +1,6 @@
 package com.example;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.Random;
 
 public class nanosecond {
@@ -15,8 +12,8 @@ public class nanosecond {
         try {
              Thread.sleep(0); //线程休眠
             Random random = new Random();
-            for (int i = 0; i <= 5; i++) {
-                arrayList.add(random.nextInt(5) + 1);
+            for (int i = 0; i <= 1000; i++) {
+                arrayList.add(random.nextInt(1000) + 1);
             }
         } catch (InterruptedException e) {
             e.printStackTrace();