text_format generator in Java