java time difference

The following code does not make sense, just record

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);

Guess you like

Origin www.cnblogs.com/Wicher-lsl/p/11480486.html