多线程唤醒时间问题,想用millis来测一个运行时间,用作唤醒,没成功。问题在哪?

public class Double implements Runnable {

    private int time; 
   public Double (int time) {
       this.time = time;
   }

    public Double() {

    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    @Override
    public void run() {

        List list = new ArrayList<>();
        Long millis1= System.currentTimeMillis();   
        for (int i = 0; i < 100; i++) {
            int rand = (int)(Math.random()*100);

            System.out.println(Thread.currentThread().getName()+":"+rand);

            list.add(rand);
            try {
                Thread.sleep((int)(Math.random()*200));
            } catch (InterruptedException e) {
                System.out.println("醒来");
            }

        }
        Long millis2= System.currentTimeMillis();   

        time  = (int)(millis2-millis1);

        System.out.println("经过时间:"+time);


        try {
            Thread.sleep(10*1000);
        } catch (Exception e) {
            System.out.println("睡10秒");
        }
        System.out.println(list);
    }


    }

////////////////////////////////////////////////////这是一条分割线
public class DoubleTest {
    public static void main(String[] args) {

        Runnable runner = new Double();//必须有构造器,系统加
        Thread thread1 = new Thread(runner);
        thread1.setName("随机整数");
        thread1.start();


        if(((Double)runner).getTime()!=0) {

            try {
                thread1.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            thread1.interrupt();

        }

    }
}

https://www.cnblogs.com/skywang12345/p/3479224.html