Java tutorial
import java.util.Formatter; public class Main { public static void main(String[] argv) throws Exception { Formatter fmt = new Formatter(); fmt.format("Default positive and negative format: %.2f %.2f\n", 423.78, -505.09); fmt.format("With + and parentheses: %+.2f %(.2f\n", 423.78, -505.09); System.out.println(fmt); } }