The format specifiers uppercase versions will cause the conversion to use uppercase where appropriate.
The following table describes the effect.
Specifier | Effect |
---|---|
%A | Causes the hexadecimal digits a through f to be displayed in uppercase as A through F. Also, the prefix 0x is displayed as 0X, and the p will be displayed as P. |
%B | Upper cases the values true and false. |
%E | Causes the e symbol that indicates the exponent to be displayed in uppercase. |
%G | Causes the e symbol that indicates the exponent to be displayed in uppercase. |
%H | Causes the hexadecimal digits a through f to be displayed in uppercase as A through F. |
%S | Upper cases the corresponding string. |
%T | Causes all alphabetical output to be displayed in uppercase. |
%X | Causes the hexadecimal digits a through f to be displayed in uppercase as A through F. Also, the optional prefix 0x is displayed as 0X, if present. |
// Demonstrate the space format specifiers. import java.util.Formatter; public class Main { public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%X", 250); /* w ww .j a v a 2s .c om*/ System.out.println(fmt); fmt.close(); fmt = new Formatter(); fmt.format("%E", 123.1234); System.out.println(fmt); fmt.close(); } }