A visualization tool is provided to allow you to watch your program play. To use this tool, you must adapt your solution to read input from standard in and write output to standard out. Each time move is called, you should read the four parameters in the same order that they are presented to your method. To read each of the two string arrays, you should first read in its length, on a line by itself. The elements will then be given to you, one per line. To read in the completed parameter, you should simply read a single line with four numbers on it, separated by spaces. Finally, you should read a line with a single integer, position. After reading the input, you should write your move on a line by itself:
            N = parseInt(nextLine());
            stacks = new string[N];
            for(int i = 0; i<N; i++){
                stacks[i] = nextLine();
            M = parseInt(nextLine());
            String[] deck = new String[M];
            for(int i = 0; i<M; i++){
                deck[i] = nextLine();
            int[] completed = new int[4];
            sp = nextLine().split(' ');
            for(int i = 0; i<4; i++)
                completed[i]= parseInt(sp[i]);
            position = parseInt(nextLine());
Once you have adapted your solution, you will need to download and install the visualizer. You can download an executable jar or you can get the source. In addition, you will have to download and extract the card images. Once you have placed all these files, along with your executable in the same directory, you can run the visualizer with something like the following command:
java -jar Klondike.jar -exec "java Sol" -seed 1 -pause 3
The -exec parameter tells the visualizer what command to run, while the -seed gives the random number generator seed, and -pause gives the pause time (in milliseconds) between moves. You may also add a -novis command to only run your program to run the test case without visualization.

Since you will be writing output to standard out, you may not use this to debug. Instead, you may write debugging output to standard error, and that will be sent to the terminal. A final note: remember to flush your output buffers after writing each move.