IT rekvalifikace s garancí práce. Seniorní programátoři vydělávají až 160 000 Kč/měsíc a rekvalifikace je prvním krokem. Zjisti, jak na to!
Hledáme nové posily do ITnetwork týmu. Podívej se na volné pozice a přidej se do nejagilnější firmy na trhu - Více informací.

Java test rychlosti

java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fasttest;


/**
 *
 * @author Milan Gallas
 */
public class FastTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("Hello world");
        
        long startProgram = new java.util.Date().getTime();
        
        int limitMatrix = 10000;
        
        int[][] matrix = new int[limitMatrix][limitMatrix];
        
        for(int i = 0; i < limitMatrix;i++){
            for(int j = 0; j<limitMatrix; j++){
                //System.out.println("i = "+i+" and j = "+ j);
                matrix[i][j] = i*j;
            }
        }
        
        long afterPush = new java.util.Date().getTime();
        
        System.out.println(afterPush - startProgram+ " in ms");
        // 1000 záznamů => (31,16,31,31,31) ms
        // 10000 záznamů => (1250, 1108, 842, 941, 936) ms
    }
    
}

Neformátovaný

Přidáno: 5.3.2017
Expirace: Neuvedeno

Avatar
Autor: Milan Gallas
Aktivity