I am trying to time how long something takes and i cant get it to spit out the seconds without rounding. Here is what ive tried:
long beginTime = System.nanoTime();
//Do something
long endTime = System.nanoTime();
double time = (endTime-beginTime)/1000000000;
I've also tried using the function TimeUnit.NANOSECONDS.toSeconds
and that rounds the number as well.
It should give me 1.45
seconds but it gives me 1
and it should be 1445.7191
Milliseconds but it gives me 1446
.