Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. n0n [0, 4, 6]
  2.  
  3. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  4. at java.util.Arrays.copyOf(Unknown Source)
  5. at java.util.Arrays.copyOf(Unknown Source)
  6. at java.util.ArrayList.grow(Unknown Source)
  7. at java.util.ArrayList.ensureExplicitCapacity(Unknown Source)
  8. at java.util.ArrayList.ensureCapacityInternal(Unknown Source)
  9. at java.util.ArrayList.add(Unknown Source)
  10. at guessingTool.CheckProgram.main(CheckProgram.java:103)
  11.  
  12. for (int i = 0; i < 5; i++) {
  13.  
  14. index = randomGenerator.nextInt(valuesList.size());
  15. value = valuesList.get(index);
  16.  
  17. finalValue = "";
  18. positions.clear();
  19. for (int j = 0; j < 3; j++) {
  20. index = randomGenerator.nextInt(value.length());
  21. valueChar = value.charAt(index);
  22. positions.add(index);
  23.  
  24. if (j == 0) {
  25. finalValue += Character.toString(valueChar);
  26. }
  27. else if (j == 1) {
  28. if (positions.get(0) != positions.get(1)) {
  29. finalValue += Character.toString(valueChar);
  30. }
  31. else {
  32. while (positions.get(0) == positions.get(1)) {
  33. index = randomGenerator.nextInt(value.length());
  34. valueChar = value.charAt(index);
  35. positions.add(index);
  36. }
  37. }
  38. }
  39. else if (j == 2) {
  40. if (positions.get(0) != positions.get(2) && positions.get(1) != positions.get(2)) {
  41. finalValue += Character.toString(valueChar);
  42. }
  43. else {
  44. while (positions.get(0) == positions.get(2) || positions.get(1) == positions.get(2)) {
  45. index = randomGenerator.nextInt(passcode.length());
  46. valueChar = value.charAt(index);
  47. positions.add(index);
  48. }
  49. }
  50. }
  51.  
  52. }
  53. System.out.println(finalValue + " " + positions);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement