Date a = new Date();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        Date b = new Date();
        long time = b.getTime();
        System.out.println(time);
        long time1 = a.getTime();
        System.out.println(time1);
        long interval = (b.getTime() - a.getTime())/1000;
        System.out.println("两个时间相差"+interval+"秒");