Java String.format(Locale l, String format, Object ... args)
Syntax
String.format(Locale l, String format, Object ... args) has the following syntax.
public static String format(Locale l, String format, Object ... args)
Example
In the following code shows how to use String.format(Locale l, String format, Object ... args) method.
/*from w w w .j a v a2 s . co m*/
import java.util.Locale;
public class Main {
public static void main(String[] args) {
double piVal = Math.PI;
System.out.format(Locale.US, "%10.2f", piVal);
}
}
The code above generates the following result.