public static void main(String[] args) throws InterruptedException{
long sTime = new Date().getTime();
Thread.sleep(3234);
long eTime = new Date().getTime();
float diff = ((eTime-sTime)/1000);
System.out.println(diff);
}
在上面的代码中,我期望输出为 3.234 但它是 3.0。我想要以秒为单位的两次之间的确切差异,并带有小数部分。