I am using the following code to start a process builder.I want to know how can I redirect its output to a `String`.

```
ProcessBuilder pb = new ProcessBuilder(
    System.getProperty("user.dir") + "/src/generate_list.sh", filename);
Process p = pb.start();

```

I tried using `ByteArrayOutputStream` but it didn't seem to work.