1
I started my algorithm this way so that I can measure its running time, but I’m not sure if it’s right, how to continue with an example:
package heapsort;
public class Heapsort {
public static void main(String[] args) {
int quantidade = 1000;
int[] vetor = new int[quantidade];
int tamanho;
for(int i = 0; i < vetor.length; i++){
vetor[i] = (int) (Math.random()*quantidade);
}
long tempoInicial = System.currentTimeMillis();
}
}
Get the time immediately before running, get the time immediately after running. Subtract one from the other. Here’s the algorithm.
– Jéf Bueno
https://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java
– hkotsubo
I have a project created to measure these things. I created to make this answer: https://answall.com/a/235636/64969
– Jefferson Quesado