Subversion Repositories distributed

Rev

Rev 21 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. package de.viathinksoft.immortal.internal;
  2.  
  3. import java.math.BigInteger;
  4.  
  5. public class Endzeitpunkt {
  6.  
  7.         // Allgemeine Daten zum Test (GenX)
  8.         private static final BigInteger TEST_BEGINN = new BigInteger("1291006160");
  9.  
  10.         // Der alte Algorithmus (r19)
  11.         // private static final int ABSCHNITT_STEP = 3;
  12.         // private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("789");
  13.         // private static final BigInteger ABFALL_MEDIAN = new BigInteger("199");
  14.  
  15.         // Der neue Algorithmus (r20)
  16.         private static final int ABSCHNITT_STEP = 29;
  17.         private static final BigInteger ABSCHNITT_BEGINN = new BigInteger("94923");
  18.         private static final BigInteger ABFALL_MEDIAN = new BigInteger("30");
  19.  
  20.         private static BigInteger f(int u) {
  21.                 BigInteger res = ABSCHNITT_BEGINN;
  22.                 for (int i = ABSCHNITT_STEP + 1; i <= u; i++) {
  23.                         res = res.add(ABFALL_MEDIAN.multiply(BigInteger.valueOf(i)));
  24.                 }
  25.                 return res;
  26.         }
  27.  
  28.         private static BigInteger u(int u) {
  29.                 return f(u).add(TEST_BEGINN);
  30.         }
  31.  
  32.         public static void main(String[] args) {
  33.                 int max_step = Integer.MAX_VALUE / 100000;
  34.  
  35.                 System.out.println("End time for step: " + max_step);
  36.                 System.out.println(u(max_step));
  37.         }
  38.  
  39. }
  40.