| 68 | } |
| 69 | |
| 70 | public static void main(String[] args) { |
| 71 | int ARRAY_SIZE = 800; // 8000000; |
| 72 | int ACCEPTABLE_SIZE = 100; // 100000; |
| 73 | List<String> letters = new ArrayList<String>(ARRAY_SIZE); |
| 74 | final char key = 'A'; |
| 75 | // fill the big array with A-Z randomly |
| 76 | for (int i = 0; i < ARRAY_SIZE; i++) { |
| 77 | char t = (char) (Math.random() * 26 + 65); |
| 78 | letters.add(String.valueOf(t)); // A-Z |
| 79 | } |
| 80 | |
| 81 | SampleAppTest sampleAppTest = new SampleAppTest(); |
| 82 | try { |
| 83 | sampleAppTest.setUp(); |
| 84 | } catch (Exception e) { |
| 85 | e.printStackTrace(); |
| 86 | } |
| 87 | ForkJoinPool pool = new ForkJoinPool(); |
| 88 | ForkJoinTestSample forkJoinTestSample = new ForkJoinTestSample( |
| 89 | sampleAppTest, ACCEPTABLE_SIZE, letters, key, 0, letters.size()); |
| 90 | ForkJoinTestJdon ft = new ForkJoinTestJdon(forkJoinTestSample); |
| 91 | int count = pool.invoke(ft); |
| 92 | System.out.print("\n found count " + count); |
| 93 | |
| 94 | sampleAppTest.tearDown(); |
| 95 | pool.shutdown(); |
| 96 | |
| 97 | } |
| 98 | |
| 99 | } |