Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 MyASD;
- import java.util.ArrayList;
- /**
- *
- * @author Student
- */
- public class Main {
- public long testWstawLinie(int liczbaElem){
- long czasStart=System.currentTimeMillis();
- ArrayList<String> list= new ArrayList();
- for(int i=0; i<liczbaElem; i++){
- list.add("Ala");
- }
- long czasStop=System.currentTimeMillis();
- return czasStop-czasStart;
- }
- public long testPrzegladania(int liczbaElem, int liczbaPrzegladow){
- ArrayList<String> list= new ArrayList();
- for(int i=0; i<liczbaElem; i++){
- list.add("Ala");
- }
- long czasStart=System.currentTimeMillis();
- //------------------------------------------------------------------
- for(int i=0; i<liczbaPrzegladow; i++){
- for(int j=0; j<liczbaElem; j++){
- String elem=list.get(i);
- }
- }
- //------------------------------------------------------------------
- long czasStop=System.currentTimeMillis();
- return czasStop-czasStart;
- }
- public void testUsuwania(){
- }
- public static void main(String [] args){
- Main test=new Main();
- long czas=test.testWstawLinie(100000000);
- System.out.println("czas wstawiania="+czas);
- long czasPrzegladania=test.testPrzegladania(100000000, 5);
- System.out.println("czas przegladania="+czasPrzegladania);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement