Working example:
StringBuilder plantUmlSource = new StringBuilder();
plantUmlSource.append("@startuml\n");
plantUmlSource.append("Alice -> Bob: Authentication Request\n");
plantUmlSource.append("Bob --> Alice: Authentication Response\n");
plantUmlSource.append("@enduml");
SourceStringReader reader = new SourceStringReader(plantUmlSource.toString());
FileOutputStream output = new FileOutputStream(new File("/your/path/to/plantuml/test.svg"));
reader.generateImage(output, new FileFormatOption(FileFormat.SVG, false));