public boolean checkCommand(String checkCommandString, int... successCodes) {
        try {
            Process process = Runtime.getRuntime().exec(checkCommandString);
            process.waitFor();
            int result = process.waitFor();
            for (int code : successCodes) {
                if (code == result) {
                    return true;
                }
            }
            return false;
        } catch (IOException e) {
            // Some problem, command is there or is broken
            System.err.println("Broken pipe");
            return false;
        } catch (InterruptedException ie) {
            // Some problem, command is there or is broken
            System.err.println("Interrupted");
            return false;
        }
    }
Checks to see if the command can be run. Typically used with
something like "myapp --version" to check to see if "myapp"
is installed and on the path.

@param checkCommandString The command to run and check the return code of.
@param successCodes       Return codes that signify success.
tika-translate/src/main/java/org/apache/tika/language/translate/impl/ExternalTranslator.java