Java: espere el proceso de ejecución hasta que salga

Estoy ejecutando un programa java en Windows que recopila registros de eventos de Windows. Se crea un archivo .csv en el que se deben realizar ciertas operaciones.

Los comandos se explican y se canalizan. ¿Cómo puedo hacer que mi programa Java espere hasta que finalice el proceso?

Aquí está el fragmento de código que estoy usando:

Runtime commandPrompt = Runtime.getRuntime();
try {           
    Process powershell = commandPrompt.exec("powershell -Command \"get-winevent -FilterHashTable @{ logname = 'Microsoft-Windows-PrintService/Operational';StartTime = '"+givenDate+" 12:00:01 AM'; EndTime = '"+beforeDay+" 23:59:59 ';  ID = 307 ;} | ConvertTo-csv| Out-file "+ file +"\"");
//I have tried waitFor() here but that does not seem to work, required command is executed but is still blocked
} catch (IOException e) { }
// Remaining code should get executed only after above is completed.

Respuestas a la pregunta(3)

Su respuesta a la pregunta