import java.util.ArrayList; import java.lang.*; import javax.swing.JOptionPane; public class Stoppuhr { static long millis = System.currentTimeMillis(); static long laufzeit = Integer.valueOf(JOptionPane.showInputDialog("Laufzeit")); static long trigger = Integer.valueOf(JOptionPane.showInputDialog("Trigger")); static ArrayList speicher = new ArrayList(); public static void main(String[] args) throws InterruptedException { ArrayFuellen(laufzeit, trigger); for(int i = 0; i < speicher.size(); i++) System.out.println(speicher.get(i)); } public static void ArrayFuellen(long laufzeit, long trigger) throws InterruptedException { while((System.currentTimeMillis() - millis) <= laufzeit) { int i = 1; speicher.add(i); i = i * 2; Thread.sleep(trigger); } } }