// Sorting the array and printing the result to 'bsOutput' public static void main(String args[]) { long st, et; st = System.nanoTime(); long tt; // getting concurency if (args.length > 1) // 2nd argument to main should be the concurency { concurency = args[1]; // getting the concurency - 2nd parameter if (concurency.equals(low_concurency)) sync = hi_sync; else if (concurency.equals(mid_concurency)) sync = mid_sync; else // in case of hi concurency or need for default value { sync = low_sync; // setting default value if (!concurency.equals(low_concurency)) // in case no legal value was entered System.out.println( "Concurency in 2nd parameter must be one of the following: \n" + "Low concurency: '" + low_concurency + "' , Mid concurency: '" + mid_concurency + "' , or High concurency, which is also the default value: '" + hi_concurency + "'. \n" + "The program runs with the default value"); } } else // in case 2nd parameter was not set sync = low_sync; // setting default value // Running the Bubble Sort Program try { for (int i = 0; i < array.length; ++i) // printing the original array System.out.print(BubbleSort.array[i] + " "); System.out.println(""); System.out.println(""); // creating a BubbleSort object with level of synchronization, oposite to concurency BubbleSortImpl bs = new BubbleSortImpl(array, new File(bsOutput), sync); bs.Sort(); // sorting the array with Bubble sort Algorithem bs.PrintArray(); // printing the sorted array } catch (IOException e) { return; } Reporter reporter = null; // Checking and reporting results try { reporter = Reporter.GetInstance(bsOutput); if (args.length > 0) // in case the program recieves 1st parameter rOutput = args[0]; // this parameter exchanges the default output path reporter.Report(rOutput, array); // creatinr the report } catch (IOException e) { } et = System.nanoTime(); tt = (et - st) / 1000; System.out.println(tt); }