FR:
Le but de ce quiz est de rendre ce code plus performant d'un ordre de magnitude uniquement en ajoutant 1 ligne. Evidemment, le benchmark doit toujours réaliser la même fonction, c'est-à-dire mesurer le temps nécessaire pour transformer le tableau d'entiers en tableau de wrappers d'entiers.
Mes résultats : avant : 1700ms (très variable), après : 65ms (très stable)
La réponse sera apportée dans une semaine !

EN:
The goal of this quiz is to make this code run an order of magnitude faster, simply by adding a single line. Please note that the benchmark must still measure the time nessary to copy an int array into an Integer array.
Results on my box : before : 1700ms with high variability, after : 65ms, very stable.
The answer will be given in a week.

public class Quiz44 {
 
    private static final int NB_VALUES = 10000000;
    private static final int MAX_VALUE = 1000;
    private static final int NB_RUNS = 10;   
 
    public static void main(String[] args) {
 
        Integer[] boxedValues = new Integer[NB_VALUES];
        int[] values = initValues();
 
        System.out.println("Benchmarking...");
        for (int run = 1; run <= NB_RUNS; run++) {
            long t1 = System.currentTimeMillis();
            for (int i = 0; i < NB_VALUES; i++) {
                boxedValues[i] = values[i];
            }
            long t2 = System.currentTimeMillis();
            System.out.printf("Run %2d : %4dms%n", run, t2 - t1);
        }
    }
 
    /** Nothing important here, just values init. */
    private static int[] initValues() {
        System.out.println("Generating values...");
        int[] values = new int[NB_VALUES];
        Random random = new Random();
        for (int i = 0; i < values.length; i++) {
            values[i] = random.nextInt(MAX_VALUE);
        }
 
        return values;
    }
 
}