java时间差

以下代码没什么意义,只是记录

long mstart = System.nanoTime();

int mIndex = 0 ;

for (int i = 0; i < 100000000; i++) {
mIndex = i ;
if ( mIndex >= 0 ){
}
}

long mend = System.nanoTime();

for (int i = 0; i < 100000000; i++) {
mIndex = i ;
if ( mIndex > -1 ){
}
}

long mend_o = System.nanoTime();


BigDecimal diff = BigDecimal.valueOf(mend-mstart,5);
BigDecimal diff_o = BigDecimal.valueOf(mend_o-mend,5);

posted @ 2019-09-07 14:01  唯起  阅读(472)  评论(0编辑  收藏  举报