Convert proc.HasExited from C#.Net to Java
<p>I have a C#.Net console app code that transfers files between linux and windows ftp servers.  </p>

<p>The code's behavior is that I automatically open a console to display status of the file transfer. While transferring files to and from the windows server, I need to display an indicator that the file transfer is on-going (using symbols that look like they are moving or turning) . These symbols are as follows : "|" --> "/" --> "-" --> "\" --> "|" </p>

<p>There had been no problem displaying the said "indicator/symbols" in C#.Net using the following codes : </p>

<pre><code>ProcessStartInfo PSI = new ProcessStartInfo("CMD.exe", "/C [here is the call to psftp / ftp scripts]"); 

String SymbolChar = "|";
Process proc = Process.Start(PSI); 

        while (true)
        {
            Thread.sleep(20);


            if (proc.HasExited)
            {
                Console.WriteLine("\b-&gt; Done\n");
                break;
            }
            else
            {
                SymbolChar = NextChar(SymbolChar);
                Console.Write("\b{0}", SymbolChar);
            }
        }
        StreamReader srError = proc.StandardError;
        StreamReader srOutput = proc.StandardOutput;

//method used to animate status during process
    private static String NextChar(String sCurrentChar)
    {
        String sTempChar = "";

        if (sCurrentChar.equals("|")) {
            sTempChar = "/";
        }
        else if (sCurrentChar.equals("/")) {
            sTempChar = "-";
        }
        else if (sCurrentChar.equals("-")) {
            sTempChar = "\\";
        }
        else if (sCurrentChar.equals("-")) {
            sTempChar = "\\";
        }
        else if (sCurrentChar.equals("\\")) {
            sTempChar = "|";
        }

        return sTempChar;
    }
</code></pre>

<p>My problem started when I converted the said codes into java using the following :</p>

<pre><code>String sParam = "bash " + [here is the call to psftp / ftp scripts];
String cmd[] = {"/bin/bash","-c",sParam};
Process proc = Runtime.getRuntime().exec(cmd);
</code></pre>

<p>Above code is perfectly working.
Problem is I don't know how to display the "animated" characters anymore.
I suddenly don't know (and I badly need help on) how to convert this :</p>

<pre><code>Process proc = Process.Start(PSI); 

        while (true)
        {
            Thread.sleep(20);


            if (proc.HasExited)
            {
                Console.WriteLine("\b-&gt; Done\n");
                break;
            }
            else
            {
                SymbolChar = NextChar(SymbolChar);
                Console.Write("\b{0}", SymbolChar);
            }
        }
</code></pre>

<p>Do you have any idea as to what I can use for the line <strong>"if (proc.HasExited)"</strong> in java so that I could move forward?</p>

<p>Sorry for the long explanation. 
I really, really need help.</p>

<p>Thank you very much in advance!</p>
