PREMISE:
I would to make analysis to see the encryption time difference between AES-128 ,192 and 256 version with Java. I checked that the three versions are built well (i had to change only the key 16 bytes for 128, 24 bytes for 192 and 32 for 256).
I saved the time before the encryption (and after the decryption) and i made the difference. For each payload i had a lot of values of time(nanoseconds)that i saved on a csv, so i made the average, because i wanted the "real" value. For example: For the payload of 7,8 MB i had 40 values of estimated time in a csv. I made the mean and i plotted the first point on MATLAB (7.8 , mean)...and so on for other values.
long startTime = System.nanoTime();
byte[] encrypt = ob.encrypt(tempBuffer, 0, read);
long estimatedTime = System.nanoTime() - startTime;
THE PROBLEM IS:
I plotted each value but i noticed that AES-256 is faster than AES-128 (and this is impossible). Someone said to me that the problem is the WARMUP effect of the JVM... how can i "clean" the JVM each time i run the program?