What is the equivalent of the "setw" stream manipulator for C++ in Java?

I've been messing with the java.util.formatter class, but haven't figured this out yet?

Generally it's the number between the percent sign ('%') and the letter. ...much as you would see in the C 'printf' function.

StringBuilder sb = new StringBuilder();
		Formatter formatter = new Formatter(sb, Locale.US);
		formatter.format("/%10d/", 23421);

Produces this output: / 23421/

Or you could directly use C style printf method.

commented: Good answer. +6