Guest User

Main.java code

a guest
Jul 15th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. package com.kindust.NumberSequenceSolver;
  2.  
  3. import java.security.SecureRandom;
  4. import java.util.Arrays;
  5.  
  6. /* This program is free for all to use, modify, and share, PROVIDED THAT credit is given to Kindust.com for this program. 7/14/15*/
  7.  
  8. public class Main {
  9.  
  10. static int n1 = 1, n2 = 0, n3 = 0, n4 = 0, n5 = 0, targ = 0;
  11. static SecureRandom r;
  12. static int[] sorted;
  13.  
  14. public static void main(String[] args){
  15. r = new SecureRandom();
  16. n1 = 1;
  17. n2 = r.nextInt(2) + 1;
  18. n3 = r.nextInt(10) + 1;
  19. n4 = r.nextInt(25) + 1;
  20. n5 = r.nextInt(300) + 1;
  21. targ = r.nextInt(100000);
  22. if(n1 == n2 || n2 == n3 || n3 == n4 || n4 == n5 || n1 == n3 || n1 == n4 || n1 == n5 || n3 == n1 || n3 == n5 || n1 == n3 ||n1 == n5 ||n4 == n2){
  23. System.out.println();
  24. System.out.println("Failure to initialize correctly! This is a non-critical error. The bad numbers are listed below. Attempting restart...");
  25. int[] s1 = { n1, n2, n3, n4, n5 };
  26. Arrays.sort(s1);
  27. int[] s2 = { s1[0], s1[1], s1[2], s1[3], s1[4] };
  28. sorted = s2;
  29. System.out.println();
  30. System.out.println(sorted[0] + " " + sorted[1] + " " + sorted[2] + " " + sorted[3] + " " + sorted[4]);
  31. System.out.println();
  32. Main.main(null);
  33. return;
  34. }
  35. System.out.println("Program initialized, set to have a maximum target of 100,000. Starting thread...");
  36. new Thread(new Method1()).start();
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment