Advertisement
Guest User

Untitled

a guest
May 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. package de.Classes;
  2.  
  3. import java.util.Random;
  4.  
  5. public class Array {
  6.  
  7.     /*
  8.      * Benutzerdefinierte Variablen
  9.      */
  10.     static int groesse = 10000; // groesse des arrays
  11.     static int randgroesse = 10000; // der wertebereich des arrays von 0 bis ...
  12.     static int durchlaeufe = 50; // anzahl der durchfe pro algorithmus
  13.  
  14.     static int[] zahl; // das Array selbst
  15.  
  16.     static int[] clonezahl; // ist zum backupen von zahl vorgesehen
  17.  
  18.     public int getGroesse() {
  19.         return groesse;
  20.     }
  21.  
  22.     public void setGroesse(int groesse) {
  23.         Array.groesse = groesse;
  24.     }
  25.  
  26.     public int getRandgroesse() {
  27.         return randgroesse;
  28.     }
  29.  
  30.     public void setRandgroesse(int randgroesse) {
  31.         Array.randgroesse = randgroesse;
  32.     }
  33.  
  34.     public int getDurchlaeufe() {
  35.         return durchlaeufe;
  36.     }
  37.  
  38.     public void setDurchlaeufe(int durchlaeufe) {
  39.         Array.durchlaeufe = durchlaeufe;
  40.     }
  41.  
  42.     public static int[] getZahl() {
  43.  
  44.         return zahl;
  45.     }
  46.  
  47.     public void setZahl() {
  48.         zahl = new int[groesse];
  49.  
  50.         Random zufall = new Random();
  51.         for (int i = 0; i < zahl.length; i++)
  52.             zahl[i] = zufall.nextInt(randgroesse);
  53.  
  54.     }
  55.  
  56.     public static int[] getClonezahl() {
  57.  
  58.         return clonezahl;
  59.     }
  60.  
  61.     int[] getRestoreZahl() {
  62.         for (int i = 0; i < clonezahl.length; i++) {
  63.             zahl[i] = clonezahl[i];
  64.  
  65.         }
  66.  
  67.         return clonezahl;
  68.  
  69.     }
  70.  
  71.     public void setClonezahl() {
  72.  
  73.         clonezahl = new int[groesse];
  74.         for (int i = 0; i < zahl.length; i++) {
  75.             clonezahl[i] = zahl[i];
  76.         }
  77.  
  78.     }
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement