`
iwebcode
  • 浏览: 2004714 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

Formatter

 
阅读更多
public final classFormatterextendsObjectimplementsCloseable,Flushable
An interpreter(解释程序)for printf-style format strings. This class provides support forlayout(布局)justification(对齐)andalignment(排列,对准),common(普通,常规)formats for numeric, string, and date/time data, andlocale-specific(特定的语言)output. Common Java types such asbyte,BigDecimal, andCalendarare supported.Limited(受限)formattingcustomization(定制)forarbitrary(任意的)user types is provided through theFormattableinterface.

Formatters are not necessarily safe for multithreadedaccess(访问,进入). Thread safety isoptional(可选择的)and is theresponsibility(负责,责任)of users of methods in this class.

Formatted printing for the Java language isheavily inspired(很大启发)by C'sprintf. Although the format strings are similar to C, somecustomizations(定制,规范)have been made toaccommodate(适应)the Java language andexploit(利用)some of its features. Also, Java formatting is morestrict(严格)than C's; for example, if a conversion isincompatible(不符合,不相容,不适用的)with aflag(标志), an exception will be thrown. In C inapplicable flags aresilently(默默的)<wbr>ignored(忽略)</wbr>. The format strings arethus intended(便于,因此用来)to berecognizable(辨认)to C programmers but not necessarilycompletely compatible(完全兼容)with those in C.

Examples ofexpected(预期,期望)usage:

StringBuilder sb = new StringBuilder(); // Send all output to the Appendable object sb Formatter formatter = new Formatter(sb, Locale.US); // Explicit argument indices may be used to re-order output. formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d") // -> " d c b a" // Optional locale as the first argument can be used to get // locale-specific formatting of numbers. The precision and width can be // given to round and align the value. formatter.format(Locale.FRANCE, "e = %+10.4f", Math.E); // -> "e = +2,7183" // The '(' numeric flag may be used to format negative numbers with // parentheses rather than a minus sign. Group separators are // automatically inserted. formatter.format("Amount gained or lost since last statement: $ %(,.2f", balanceDelta); // -> "Amount gained or lost since last statement: $ (6,217.58)"

Convenience(便利,便捷)methods for common formatting requests exist asillustrated(说明,阐述)by the followinginvocations(调用):

// Writes a formatted string to System.out. System.out.format("Local time: %tT", Calendar.getInstance()); // -> "Local time: 13:34:18" // Writes formatted output to System.err. System.err.printf("Unable to open file '%1$s': %2$s", fileName, exception.getMessage()); // -> "Unable to open file 'food': No such file or directory"

Like C'ssprintf(3), Strings may be formatted using the static methodString.format:

// Format a string containing a date. import java.util.Calendar; import java.util.GregorianCalendar; import static java.util.Calendar.*; Calendar c = new GregorianCalendar(1995, MAY, 23); String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY", c); // -> s == "Duke's Birthday: May 23, 1995"

Organization(结构)

Thisspecification(详述,规格)isdivided(分开,分成)into two sections. The first section,Summary(摘要),covers(包含,覆盖)the basic formattingconcepts(概念).This section isintended(用于)for users who want to get started quickly and arefamiliar(熟悉)with formatted printing in otherprogramming(编程)languages. The second section,Details, covers the specific implementation details. It is intended for users who want moreprecise specification(精确规格)of formatti+ng behavior.

Summary

This section is intended to provide abrief overview(简要概述)of formatting concepts. For precisebehavioral(行为)details, refer to theDetailssection.

Format String Syntax(语法)

Every method whichproduces(产生)formatted output requires aformat stringand anargument list. The format string is aStringwhich may contain fixed text and one or moreembedded(嵌入式)<wbr><em>format<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">specifiers(说明符)</span></strong></em>.<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">Consider(考虑)</span></strong>the following example:</wbr>

Calendar c = ...; String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY", c);
This format string is the first argument to theformatmethod. It contains three format specifiers "%1$tm", "%1$te", and "%1$tY" whichindicate(指出,表明)how the arguments should beprocessed(处理)and where they should be inserted in the text. Theremaining portions(剩余的部分)of the format string are fixed text including"Dukes Birthday: "and any other spaces orpunctuation(标点). The argument listconsists(由..组成)of<wbr>all arguments passed to the method after the format string. In the<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">above(上面)</span></strong>example, the argument list is of size one and consists of the<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Calendar</code></a>object<code>c</code>. <ul style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The format specifiers for general, character, and numeric types have the following syntax: <blockquote> <pre style="white-space:normal">%[argument_index$][flags][width][.precision]conversion</pre> </blockquote> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>argument_index</em>is a decimal integer<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">indicating(表明,指定)</span></strong>the position of the argument in the argument list. The first argument is referenced by "<code>1$</code>", the second by "<code>2$</code>", etc.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>flags</em>is a set of characters that modify the output format. The set of valid flags depends on the conversion.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>width</em>is a<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">non-negative(非负)</span></strong>decimal integer indicating the minimum number of characters to be written to the output.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>precision</em>is a non-negative decimal integer usually used to<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">restrict(限制)</span></strong>the number of characters. The specific behavior depends on the conversion.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The required<em>conversion</em>is a character indicating how the argument should be formatted. The set of valid conversions for a<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">given argument(给定参数的)</span></strong>depends on the argument's data type.</p> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The format specifiers for types which are used to represents dates and times have the following syntax: <blockquote> <pre style="white-space:normal">%[argument_index$][flags][width]conversion</pre> </blockquote> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>argument_index</em>,<em>flags</em>and<em>width</em>are defined as<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">above(同上)</span></strong>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The required<em>conversion</em>is a two character sequence. The first character is<code>'t'</code>or<code>'T'</code>. The second character indicates the format to be used. These characters are similar to but not<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">completely identical(完全相同)</span></strong>to those defined by GNU<code>date</code>and POSIX<code>strftime(3c)</code>.</p> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The format specifiers which do not<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">correspond(符合,对应)</span></strong>to arguments have the following syntax: <blockquote> <pre style="white-space:normal">%[flags][width]conversion</pre> </blockquote> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The optional<em>flags</em>and<em>width</em>is defined as above.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The required<em>conversion</em>is a character<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">indicating(表明)</span></strong>content to be inserted in the output.</p> </li> </ul> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> Conversions</h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Conversions are<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">divided into(被分成)</span></strong>the following<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">categories(类别)</span></strong>:</p> <ol style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>General</strong>- may be<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">applied(应用)</span></strong>to any argument type</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Character</strong>- may be applied to basic types which represent Unicode characters:<code>char</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Character</code></a>,<code>byte</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Byte</code></a>,<code>short</code>, and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Short</code></a>. This conversion may also be applied to the types<code>int</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer</code></a>when<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Character.isValidCodePoint(int)</code></a>returns<code>true</code> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Numeric</strong> <ol style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Integral</strong>- may be applied to Java integral types:<code>byte</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Byte</code></a>,<code>short</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Short</code></a>,<code>int</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer</code></a>,<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>, and<a title="class in java.math" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigInteger</code></a> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Floating Point</strong>- may be applied to Java floating-point types:<code>float</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float</code></a>,<code>double</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double</code></a>, and<a title="class in java.math" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigDecimal</code></a> </li> </ol> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Date/Time</strong>- may be applied to Java types which are<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">capable of encoding(能够编码)</span></strong>a date or time:<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>,<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Calendar</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Percent</strong>- produces a literal<code>'%'</code>(<tt>'\u0025'</tt>)</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <strong>Line Separator(分隔符)</strong>- produces the<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">platform(平台)</span></strong>-specific line separator</li> </ol> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following table summarizes the supported conversions. Conversions<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">denoted(表示)</span></strong>by an upper-case character (i.e.<code>'B'</code>,<code>'H'</code>,<code>'S'</code>,<code>'C'</code>,<code>'X'</code>,<code>'E'</code>,<code>'G'</code>,<code>'A'</code>, and<code>'T'</code>) are the same as those for the<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">corresponding(相同的,相应的)</span></strong>lower-case conversion characters<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">except(除了)</span></strong>that the result is converted to upper case<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">according(根据)</span></strong>to<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">the rules of the prevailing(现行的规则)</span></strong><wbr><a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Locale</code></a>. The result is equivalent to the following<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">invocation(调用)</span></strong>of<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>String.toUpperCase()</code></a></wbr></p> <pre style="white-space:normal">out.toUpperCase()</pre> <table summary="genConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Conversion</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Argument Category(种类)</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Description</th> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'b'</code>,<code>'B'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> general</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> If the argument<em>arg</em>is<code>null</code>, then the result is "<code>false</code>". If<em>arg</em>is a<code>boolean</code>or<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Boolean</code></a>, then the result is the string returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>String.valueOf(arg)</code></a>. Otherwise, the result is "true".</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'h'</code>,<code>'H'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> general</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> If the argument<em>arg</em>is<code>null</code>, then the result is "<code>null</code>". Otherwise, the result is obtained by invoking<code>Integer.toHexString(arg.hashCode())</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'s'</code>,<code>'S'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> general</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> If the argument<em>arg</em>is<code>null</code>, then the result is "<code>null</code>". If<em>arg</em>implements<a title="interface in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Formattable</code></a>, then<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>arg.formatTo</code></a>is invoked. Otherwise, the result is obtained by invoking<code>arg.toString()</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'c'</code>,<code>'C'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> character</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is a Unicode character</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'d'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> integral</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as a decimal integer</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'o'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> integral</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as an octal integer</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'x'</code>,<code>'X'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> integral</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as a hexadecimal integer</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'e'</code>,<code>'E'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> floating point</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as a decimal number in computerized scientific notation</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'f'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> floating point</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as a decimal numberx</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'g'</code>,<code>'G'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> floating point</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted using computerized scientific notation or decimal format, depending on the precision and the value after rounding.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'a'</code>,<code>'A'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> floating point</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is formatted as a hexadecimal floating-point number with a significand and an exponent</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'t'</code>,<code>'T'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> date/time</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Prefix for date and time conversion characters. See<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Date/Time Conversions</a>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'%'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> percent</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is a literal<code>'%'</code>(<tt>'\u0025'</tt>)</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'n'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> line separator</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is the platform-specific line separator</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Any characters not explicitly defined as conversions are illegal(非法的) and are<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">reserved(保留)</span></strong>for future<strong><span style="color:#ED1C24; word-wrap:normal; word-break:normal; line-height:21px">extensions(扩展)</span></strong>.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50509" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dt" style="text-decoration:underline; color:rgb(65,100,111)">Date/Time Conversions</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following date and time conversion suffix characters are defined for the<code>'t'</code>and<code>'T'</code>conversions. The types are similar to but not completely identical to those defined by GNU<code>date</code>and POSIX<code>strftime(3c)</code>. Additional conversion types are provided to access Java-specific functionality (e.g.<code>'L'</code>for milliseconds within the second).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting times:</p> <table summary="time" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'H'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e.<code>00 - 23</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'I'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e.<code>01 - 12</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'k'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour of the day for the 24-hour clock, i.e.<code>0 - 23</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'l'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour for the 12-hour clock, i.e.<code>1 - 12</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'M'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Minute within the hour formatted as two digits with a leading zero as necessary, i.e.<code>00 - 59</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'S'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e.<code>00 - 60</code>("<code>60</code>" is a special value required to support leap seconds).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'L'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Millisecond within the second formatted as three digits with leading zeros as necessary, i.e.<code>000 - 999</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'N'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Nanosecond within the second, formatted as nine digits with leading zeros as necessary, i.e.<code>000000000 - 999999999</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'p'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">morning or afternoon</a>marker in lower case, e.g."<code>am</code>" or "<code>pm</code>". Use of the conversion prefix<code>'T'</code>forces this output to upper case.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'z'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <a href="http://www.ietf.org/rfc/rfc0822.txt" style="text-decoration:none; color:rgb(65,100,111)">RFC<wbr>822</wbr></a>style numeric time zone offset from GMT, e.g.<code>-0800</code>. This value will be adjusted as necessary for Daylight Saving Time. For<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>the time zone used is the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default time zone</a>for this instance of the Java virtual machine.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Z'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> A string representing the abbreviation for the time zone. This value will be adjusted as necessary for Daylight Saving Time. For<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>the time zone used is the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default time zone</a>for this instance of the Java virtual machine. The Formatter's locale will supersede the locale of the argument (if any).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'s'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Seconds since the beginning of the epoch starting at 1 January 1970<code>00:00:00</code>UTC, i.e.<code>Long.MIN_VALUE/1000</code>to<code>Long.MAX_VALUE/1000</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Q'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Milliseconds since the beginning of the epoch starting at 1 January 1970<code>00:00:00</code>UTC, i.e.<code>Long.MIN_VALUE</code>to<code>Long.MAX_VALUE</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting dates:</p> <table summary="date" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'B'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">full month name</a>, e.g.<code>"January"</code>,<code>"February"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'b'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">abbreviated month name</a>, e.g.<code>"Jan"</code>,<code>"Feb"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'h'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Same as<code>'b'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'A'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific full name of the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">day of the week</a>, e.g.<code>"Sunday"</code>,<code>"Monday"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'a'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific short name of the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">day of the week</a>, e.g.<code>"Sun"</code>,<code>"Mon"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'C'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Four-digit year divided by<code>100</code>, formatted as two digits with leading zero as necessary, i.e.<code>00 - 99</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Y'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Year, formatted as at least four digits with leading zeros as necessary, e.g.<code>0092</code>equals<code>92</code>CE for the Gregorian calendar.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'y'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Last two digits of the year, formatted with leading zeros as necessary, i.e.<code>00 - 99</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'j'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of year, formatted as three digits with leading zeros as necessary, e.g.<code>001 - 366</code>for the Gregorian calendar.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'m'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Month, formatted as two digits with leading zeros as necessary, i.e.<code>01 - 13</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'d'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of month, formatted as two digits with leading zeros as necessary, i.e.<code>01 - 31</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'e'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of month, formatted as two digits, i.e.<code>1 - 31</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting common date/time compositions.</p> <table summary="composites" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'R'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 24-hour clock as<code>"%tH:%tM"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'T'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 24-hour clock as<code>"%tH:%tM:%tS"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'r'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 12-hour clock as<code>"%tI:%tM:%tS %Tp"</code>. The location of the morning or afternoon marker (<code>'%Tp'</code>) may be locale-dependent.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'D'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Date formatted as<code>"%tm/%td/%ty"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'F'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <a href="http://www.w3.org/TR/NOTE-datetime" style="text-decoration:none; color:rgb(65,100,111)">ISO<wbr>8601</wbr></a>complete date formatted as<code>"%tY-%tm-%td"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'c'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Date and time formatted as<code>"%ta %tb %td %tT %tZ %tY"</code>, e.g.<code>"Sun Jul 20 16:17:00 EDT 1969"</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Any characters not explicitly defined as date/time conversion suffixes are illegal and are reserved for future extensions.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> Flags</h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following table summarizes the supported flags.<em>y</em>means the flag is supported for the indicated argument types.</p> <table summary="genConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Flag</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> General</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Character</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Integral</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Floating Point</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Date/Time</th> <th valign="bottom" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif"> Description</th> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '-'</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will be left-justified.</td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '#'</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>1</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>3</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result should use a conversion-dependent alternate form</td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '+'</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>4</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will always include a sign</td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '<wbr><wbr>'</wbr></wbr> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>4</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will include a leading space for positive values</td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '0'</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will be zero-padded</td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> ','</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>2</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>5</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will include locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">grouping separators</a> </td> </tr> <tr> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> '('</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>4</sup> </td> <td valign="top" align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> y<sup>5</sup> </td> <td align="middle" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> -</td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result will enclose negative numbers in parentheses</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <sup>1</sup>Depends on the definition of<a title="interface in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Formattable</code></a>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <sup>2</sup>For<code>'d'</code>conversion only.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <sup>3</sup>For<code>'o'</code>,<code>'x'</code>, and<code>'X'</code>conversions only.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <sup>4</sup>For<code>'d'</code>,<code>'o'</code>,<code>'x'</code>, and<code>'X'</code>conversions applied to<a title="class in java.math" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigInteger</code></a>or<code>'d'</code>applied to<code>byte</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Byte</code></a>,<code>short</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Short</code></a>,<code>int</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer</code></a>,<code>long</code>, and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <sup>5</sup>For<code>'e'</code>,<code>'E'</code>,<code>'f'</code>,<code>'g'</code>, and<code>'G'</code>conversions only.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Any characters not explicitly defined as flags are illegal and are reserved for future extensions.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> Width</h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The width is the minimum number of characters to be written to the output. For the line separator conversion, width is not applicable; if it is provided, an exception will be thrown.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> Precision</h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> For general argument types, the precision is the maximum number of characters to be written to the output.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> For the floating-point conversions<code>'e'</code>,<code>'E'</code>, and<code>'f'</code>the precision is the number of digits after the decimal separator. If the conversion is<code>'g'</code>or<code>'G'</code>, then the precision is the total number of digits in the resulting magnitude after rounding. If the conversion is<code>'a'</code>or<code>'A'</code>, then the precision must not be specified.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> For character, integral, and date/time argument types and the percent and line separator conversions, the precision is not applicable; if a precision is provided, an exception will be thrown.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> Argument Index</h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The argument index is a decimal integer indicating the position of the argument in the argument list. The first argument is referenced by "<code>1$</code>", the second by "<code>2$</code>", etc.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Another way to reference arguments by position is to use the<code>'&lt;'</code>(<tt>'\u003c'</tt>) flag, which causes the argument for the previous format specifier to be re-used. For example, the following two statements would produce identical strings:</p> <blockquote> <pre style="white-space:normal">Calendar c = ...; String s1 = String.format("Duke's Birthday: %1$tm %1$te,%1$tY", c); String s2 = String.format("Duke's Birthday: %1$tm %&lt;te,%&lt;tY", c);</pre> </blockquote> <hr> <h3 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50510" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="detail" style="text-decoration:underline; color:rgb(65,100,111)">Details</a> </h3> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> This section is intended to provide behavioral details for formatting, including conditions and exceptions, supported data types, localization, and interactions between flags, conversions, and data types. For an overview of formatting concepts, refer to the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Summary</a></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Any characters not explicitly defined as conversions, date/time conversion suffixes, or flags are illegal and are reserved for future extensions. Use of such a character in a format string will cause an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>UnknownFormatConversionE<wbr>xception</wbr></code></a>or<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>UnknownFormatFlagsExcept<wbr>ion</wbr></code></a>to be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the format specifier contains a width or precision with an invalid value or which is otherwise unsupported, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatWidthExcept<wbr>ion</wbr></code></a>or<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>respectively will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If a format specifier contains a conversion character that is not applicable to the corresponding argument, then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatConversionE<wbr>xception</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> All specified exceptions may be thrown by any of the<code>format</code>methods of<code>Formatter</code>as well as by any<code>format</code>convenience methods such as<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>String.format</code></a>and<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>PrintStream.printf</code></a>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Conversions denoted by an upper-case character (i.e.<code>'B'</code>,<code>'H'</code>,<code>'S'</code>,<code>'C'</code>,<code>'X'</code>,<code>'E'</code>,<code>'G'</code>,<code>'A'</code>, and<code>'T'</code>) are the same as those for the corresponding lower-case conversion characters except that the result is converted to upper case according to the rules of the prevailing<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Locale</code></a>. The result is equivalent to the following invocation of<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>String.toUpperCase()</code></a></p> <pre style="white-space:normal">out.toUpperCase()</pre> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50511" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dgen" style="text-decoration:underline; color:rgb(65,100,111)">General</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following general conversions may be applied to any argument type:</p> <table summary="dgConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'b'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0062'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Produces either "<code>true</code>" or "<code>false</code>" as returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Boolean.toString(boolean)</code></a>. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the argument is<code>null</code>, then the result is "<code>false</code>". If the argument is a<code>boolean</code>or<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Boolean</code></a>, then the result is the string returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>String.valueOf()</code></a>. Otherwise, the result is "<code>true</code>".</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'B'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0042'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'b'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'h'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0068'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Produces a string representing the hash code value of the object. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the argument,<em>arg</em>is<code>null</code>, then the result is "<code>null</code>". Otherwise, the result is obtained by invoking<code>Integer.toHexString(arg.hashCode())</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'H'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0048'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'h'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'s'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0073'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Produces a string. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the argument is<code>null</code>, then the result is "<code>null</code>". If the argument implements<a title="interface in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Formattable</code></a>, then its<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>formatTo</code></a>method is invoked. Otherwise, the result is obtained by invoking the argument's<code>toString()</code>method.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given and the argument is not a<a title="interface in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Formattable</code></a>, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'S'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0053'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'s'</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following<a title="Formatter" name="HTML_TO_HH_50512" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dFlags" style="text-decoration:underline; color:rgb(65,100,111)">flags</a>apply to general conversions:</p> <table summary="dFlags" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'-'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u002d'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Left justifies the output. Spaces (<tt>'\u0020'</tt>) will be added at the end of the converted value as required to fill the minimum width of the field. If the width is not provided, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>MissingFormatWidthExcept<wbr>ion</wbr></code></a>will be thrown. If this flag is not given then the output will be right-justified.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'#'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0023'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output use an alternate form. The definition of the form is specified by the conversion.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<a title="Formatter" name="HTML_TO_HH_50513" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="genWidth" style="text-decoration:underline; color:rgb(65,100,111)">width</a>is the minimum number of characters to be written to the output. If the length of the converted value is less than the width then the output will be padded by<tt>'<wbr><wbr>'</wbr></wbr></tt>(<tt>'\u0020'</tt>) until the total number of characters equals the width. The padding is on the left by default. If the<code>'-'</code>flag is given, then the padding will be on the right. If the width is not specified then there is no minimum.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The precision is the maximum number of characters to be written to the output. The precision is applied before the width, thus the output will be truncated to<code>precision</code>characters even if the width is greater than the precision. If the precision is not specified then there is no explicit limit on the number of characters.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50514" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dchar" style="text-decoration:underline; color:rgb(65,100,111)">Character</a> </h4> This conversion may be applied to<code>char</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Character</code></a>. It may also be applied to the types<code>byte</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Byte</code></a>,<code>short</code>, and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Short</code></a>,<code>int</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer</code></a>when<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Character.isValidCodePoint(int)</code></a>returns<code>true</code>. If it returns<code>false</code>then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatCodePointEx<wbr>ception</wbr></code></a>will be thrown. <table summary="charConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'c'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0063'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Formats the argument as a Unicode character as described in<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Unicode Character Representation</a>. This may be more than one 16-bit<code>char</code>in the case where the argument represents a supplementary character. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'C'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0043'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'c'</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<code>'-'</code>flag defined for<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">General conversions</a>applies. If the<code>'#'</code>flag is given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The width is defined as for<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">General conversions</a>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The precision is not applicable. If the precision is specified then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>will be thrown.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50515" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dnum" style="text-decoration:underline; color:rgb(65,100,111)">Numeric</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Numeric conversions are divided into the following categories:</p> <ol style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><strong>Byte, Short, Integer, and Long</strong></a> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><strong>BigInteger</strong></a> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><strong>Float and Double</strong></a> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> <a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><strong>BigDecimal</strong></a> </li> </ol> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Numeric types will be formatted according to the following algorithm:</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <strong><a title="Formatter" name="HTML_TO_HH_50516" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="l10n%20algorithm" style="text-decoration:underline; color:rgb(65,100,111)">Number Localization Algorithm</a></strong></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> After digits are obtained for the integer part, fractional part, and exponent (as appropriate for the data type), the following transformation is applied:</p> <ol style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> Each digit character<em>d</em>in the string is replaced by a locale-specific digit computed relative to the current locale's<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">zero digit</a><em>z</em>; that is<em>d<wbr>-<wbr></wbr></wbr></em><code>'0'</code><em><wbr>+<wbr>z</wbr></wbr></em>.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If a decimal separator is present, a locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">decimal separator</a>is substituted.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If the<code>','</code>(<tt>'\u002c'</tt>)<a title="Formatter" name="HTML_TO_HH_50517" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="l10n%20group" style="text-decoration:underline; color:rgb(65,100,111)">flag</a>is given, then the locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">grouping separator</a>is inserted by scanning the integer part of the string from least significant to most significant digits and inserting a separator at intervals defined by the locale's<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">grouping size</a>.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If the<code>'0'</code>flag is given, then the locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">zero digits</a>are inserted after the sign character, if any, and before the first non-zero digit, until the length of the string is equal to the requested field width.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If the value is negative and the<code>'('</code>flag is given, then a<code>'('</code>(<tt>'\u0028'</tt>) is prepended and a<code>')'</code>(<tt>'\u0029'</tt>) is appended.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If the value is negative (or floating-point negative zero) and<code>'('</code>flag is not given, then a<code>'-'</code>(<tt>'\u002d'</tt>) is prepended.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:decimal; list-style-position:initial"> If the<code>'+'</code>flag is given and the value is positive or zero (or floating-point positive zero), then a<code>'+'</code>(<tt>'\u002b'</tt>) will be prepended.</li> </ol> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the value is NaN or positive infinity the literal strings "NaN" or "Infinity" respectively, will be output. If the value is negative infinity, then the output will be "(Infinity)" if the<code>'('</code>flag is given otherwise the output will be "-Infinity". These values are not localized.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <a title="Formatter" name="HTML_TO_HH_50518" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dnint" style="text-decoration:underline; color:rgb(65,100,111)"><strong>Byte, Short, Integer, and Long</strong></a></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversions may be applied to<code>byte</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Byte</code></a>,<code>short</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Short</code></a>,<code>int</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer</code></a>,<code>long</code>, and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>.</p> <table summary="IntConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'d'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0054'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Formats the argument as a decimal integer. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'0'</code>flag is given and the value is negative, then the zero padding will occur after the sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'o'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006f'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Formats the argument as an integer in base eight. No localization is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is negative then the result will be an unsigned value generated by adding 2<sup>n</sup>to the value where<code>n</code>is the number of bits in the type as returned by the static<code>SIZE</code>field in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Byte</a>,<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Short</a>,<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Integer</a>, or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Long</a>classes as appropriate.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then the output will always begin with the radix indicator<code>'0'</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'0'</code>flag is given then the output will be padded with leading zeros to the field width following any indication of sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<code>'('</code>,<code>'+'</code>, '<wbr><wbr>', or<code>','</code>flags are given then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</wbr></wbr></p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'x'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0078'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Formats the argument as an integer in base sixteen. No localization is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is negative then the result will be an unsigned value generated by adding 2<sup>n</sup>to the value where<code>n</code>is the number of bits in the type as returned by the static<code>SIZE</code>field in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Byte</a>,<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Short</a>,<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Integer</a>, or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">Long</a>classes as appropriate.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then the output will always begin with the radix indicator<code>"0x"</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'0'</code>flag is given then the output will be padded to the field width with leading zeros after the radix indicator or sign (if present).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<code>'('</code>,<tt>'<wbr><wbr>'</wbr></wbr></tt>,<code>'+'</code>, or<code>','</code>flags are given then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'X'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0058'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'x'</code>. The entire string representing the number will be converted to<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">upper case</a>including the<code>'x'</code>(if any) and all hexadecimal digits<code>'a'</code>-<code>'f'</code>(<tt>'\u0061'</tt>-<tt>'\u0066'</tt>).</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the conversion is<code>'o'</code>,<code>'x'</code>, or<code>'X'</code>and both the<code>'#'</code>and the<code>'0'</code>flags are given, then result will contain the radix indicator (<code>'0'</code>for octal and<code>"0x"</code>or<code>"0X"</code>for hexadecimal), some number of zeros (based on the width), and the value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<code>'-'</code>flag is not given, then the space padding will occur before the sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following<a title="Formatter" name="HTML_TO_HH_50519" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="intFlags" style="text-decoration:underline; color:rgb(65,100,111)">flags</a>apply to numeric integral conversions:</p> <table summary="intFlags" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'+'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u002b'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to include a positive sign for all positive numbers. If this flag is not given then only negative values will include a sign. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If both the<code>'+'</code>and<tt>'<wbr><wbr>'</wbr></wbr></tt>flags are given then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatFlagsExcept<wbr>ion</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'<wbr><wbr>'</wbr></wbr></tt> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0020'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to include a single extra space (<tt>'\u0020'</tt>) for non-negative values. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If both the<code>'+'</code>and<tt>'<wbr><wbr>'</wbr></wbr></tt>flags are given then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatFlagsExcept<wbr>ion</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'0'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0030'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be padded with leading<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">zeros</a>to the minimum field width following any sign or radix indicator except when converting NaN or infinity. If the width is not provided, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>MissingFormatWidthExcept<wbr>ion</wbr></code></a>will be thrown. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If both the<code>'-'</code>and<code>'0'</code>flags are given then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatFlagsExcept<wbr>ion</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>','</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u002c'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to include the locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">group separators</a>as described in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">"group" section</a>of the localization algorithm.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'('</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0028'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to prepend a<code>'('</code>(<tt>'\u0028'</tt>) and append a<code>')'</code>(<tt>'\u0029'</tt>) to negative values.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If no<a title="Formatter" name="HTML_TO_HH_50520" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="intdFlags" style="text-decoration:underline; color:rgb(65,100,111)">flags</a>are given the default formatting is as follows:</p> <ul style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The output is right-justified within the<code>width</code> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> Negative numbers begin with a<code>'-'</code>(<tt>'\u002d'</tt>)</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> Positive numbers and zero do not include a sign or extra leading space</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> No grouping separators are included</li> </ul> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<a title="Formatter" name="HTML_TO_HH_50521" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="intWidth" style="text-decoration:underline; color:rgb(65,100,111)">width</a>is the minimum number of characters to be written to the output. This includes any signs, digits, grouping separators, radix indicator, and parentheses. If the length of the converted value is less than the width then the output will be padded by spaces (<tt>'\u0020'</tt>) until the total number of characters equals width. The padding is on the left by default. If<code>'-'</code>flag is given then the padding will be on the right. If width is not specified then there is no minimum.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The precision is not applicable. If precision is specified then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <a title="Formatter" name="HTML_TO_HH_50522" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dnbint" style="text-decoration:underline; color:rgb(65,100,111)"><strong>BigInteger</strong></a></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversions may be applied to<a title="class in java.math" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigInteger</code></a>.</p> <table summary="BIntConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'d'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0054'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted as a decimal integer. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'o'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006f'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted as an integer in base eight. No localization is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is negative then the result will be a signed value beginning with<code>'-'</code>(<tt>'\u002d'</tt>). Signed output is allowed for this type because unlike the primitive types it is not possible to create an unsigned equivalent without assuming an explicit data-type size.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is positive or zero and the<code>'+'</code>flag is given then the result will begin with<code>'+'</code>(<tt>'\u002b'</tt>).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then the output will always begin with<code>'0'</code>prefix.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'0'</code>flag is given then the output will be padded with leading zeros to the field width following any indication of sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>','</code>flag is given then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'x'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0078'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted as an integer in base sixteen. No localization is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is negative then the result will be a signed value beginning with<code>'-'</code>(<tt>'\u002d'</tt>). Signed output is allowed for this type because unlike the primitive types it is not possible to create an unsigned equivalent without assuming an explicit data-type size.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is positive or zero and the<code>'+'</code>flag is given then the result will begin with<code>'+'</code>(<tt>'\u002b'</tt>).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then the output will always begin with the radix indicator<code>"0x"</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'0'</code>flag is given then the output will be padded to the field width with leading zeros after the radix indicator or sign (if present).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>','</code>flag is given then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'X'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0058'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'x'</code>. The entire string representing the number will be converted to<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">upper case</a>including the<code>'x'</code>(if any) and all hexadecimal digits<code>'a'</code>-<code>'f'</code>(<tt>'\u0061'</tt>-<tt>'\u0066'</tt>).</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the conversion is<code>'o'</code>,<code>'x'</code>, or<code>'X'</code>and both the<code>'#'</code>and the<code>'0'</code>flags are given, then result will contain the base indicator (<code>'0'</code>for octal and<code>"0x"</code>or<code>"0X"</code>for hexadecimal), some number of zeros (based on the width), and the value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<code>'0'</code>flag is given and the value is negative, then the zero padding will occur after the sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<code>'-'</code>flag is not given, then the space padding will occur before the sign.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> All<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">flags</a>defined for Byte, Short, Integer, and Long apply. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default behavior</a>when no flags are given is the same as for Byte, Short, Integer, and Long.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The specification of<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">width</a>is the same as defined for Byte, Short, Integer, and Long.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The precision is not applicable. If precision is specified then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <a title="Formatter" name="HTML_TO_HH_50523" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dndec" style="text-decoration:underline; color:rgb(65,100,111)"><strong>Float and Double</strong></a></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversions may be applied to<code>float</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float</code></a>,<code>double</code>and<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double</code></a>.</p> <table summary="floatConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'e'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0065'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted using<a title="Formatter" name="HTML_TO_HH_50524" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="scientific" style="text-decoration:underline; color:rgb(65,100,111)">computerized scientific notation</a>. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is NaN or infinite, the literal strings "NaN" or "Infinity", respectively, will be output. These values are not localized.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is positive-zero or negative-zero, then the exponent will be<code>"+00"</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> Otherwise, the result is a string that represents the sign and magnitude (absolute value) of the argument. The formatting of the sign is described in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>. The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> Let<em>n</em>be the unique integer such that 10<sup><em>n</em></sup>&lt;=<em>m</em>&lt; 10<sup><em>n</em>+1</sup>; then let<em>a</em>be the mathematically exact quotient of<em>m</em>and 10<sup><em>n</em></sup>so that 1 &lt;=<em>a</em>&lt; 10. The magnitude is then represented as the integer part of<em>a</em>, as a single decimal digit, followed by the decimal separator followed by decimal digits representing the fractional part of<em>a</em>, followed by the exponent symbol<code>'e'</code>(<tt>'\u0065'</tt>), followed by the sign of the exponent, followed by a representation of<em>n</em>as a decimal integer, as produced by the method<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long.toString(long, int)</code></a>, and zero-padded to include at least two digits.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The number of digits in the result for the fractional part of<em>m</em>or<em>a</em>is equal to the precision. If the precision is not specified then the default value is<code>6</code>. If the precision is less than the number of digits which would appear after the decimal point in the string returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float.toString(float)</code></a>or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double.toString(double)</code></a>respectively, then the value will be rounded using the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">round half up algorithm</a>. Otherwise, zeros may be appended to reach the precision. For a canonical representation of the value, use<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float.toString(float)</code></a>or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double.toString(double)</code></a>as appropriate.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>','</code>flag is given, then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'E'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0045'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'e'</code>. The exponent symbol will be<code>'E'</code>(<tt>'\u0045'</tt>).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'g'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0067'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted in general scientific notation as described below. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> After rounding for the precision, the formatting of the resulting magnitude<em>m</em>depends on its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is greater than or equal to 10<sup>-4</sup>but less than 10<sup>precision</sup>then it is represented in<em><a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">decimal format</a></em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is less than 10<sup>-4</sup>or greater than or equal to 10<sup>precision</sup>, then it is represented in<em><a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">computerized scientific notation</a></em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The total number of significant digits in<em>m</em>is equal to the precision. If the precision is not specified, then the default value is<code>6</code>. If the precision is<code>0</code>, then it is taken to be<code>1</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'G'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0047'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'g'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'f'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0066'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted using<a title="Formatter" name="HTML_TO_HH_50525" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="decimal" style="text-decoration:underline; color:rgb(65,100,111)">decimal format</a>. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The result is a string that represents the sign and magnitude (absolute value) of the argument. The formatting of the sign is described in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>. The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>NaN or infinite, the literal strings "NaN" or "Infinity", respectively, will be output. These values are not localized.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The magnitude is formatted as the integer part of<em>m</em>, with no leading zeroes, followed by the decimal separator followed by one or more decimal digits representing the fractional part of<em>m</em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The number of digits in the result for the fractional part of<em>m</em>or<em>a</em>is equal to the precision. If the precision is not specified then the default value is<code>6</code>. If the precision is less than the number of digits which would appear after the decimal point in the string returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float.toString(float)</code></a>or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double.toString(double)</code></a>respectively, then the value will be rounded using the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">round half up algorithm</a>. Otherwise, zeros may be appended to reach the precision. For a canonical representation of the value, use<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Float.toString(float)</code></a>or<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double.toString(double)</code></a>as appropriate.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'a'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0061'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted in hexadecimal exponential form. No localization is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The result is a string that represents the sign and magnitude (absolute value) of the argument<em>x</em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is negative or a negative-zero value then the result will begin with<code>'-'</code>(<tt>'\u002d'</tt>).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>x</em>is positive or a positive-zero value and the<code>'+'</code>flag is given then the result will begin with<code>'+'</code>(<tt>'\u002b'</tt>).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The formatting of the magnitude<em>m</em>depends upon its value.</p> <ul style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> If the value is NaN or infinite, the literal strings "NaN" or "Infinity", respectively, will be output.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> If<em>m</em>is zero then it is represented by the string<code>"0x0.0p0"</code>.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> If<em>m</em>is a<code>double</code>value with a normalized representation then substrings are used to represent the significand and exponent fields. The significand is represented by the characters<code>"0x1."</code>followed by the hexadecimal representation of the rest of the significand as a fraction. The exponent is represented by<code>'p'</code>(<tt>'\u0070'</tt>) followed by a decimal string of the unbiased exponent as if produced by invoking<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Integer.toString</code></a>on the exponent value.</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> If<em>m</em>is a<code>double</code>value with a subnormal representation then the significand is represented by the characters<code>'0x0.'</code>followed by the hexadecimal representation of the rest of the significand as a fraction. The exponent is represented by<code>'p-1022'</code>. Note that there must be at least one nonzero digit in a subnormal significand.</li> </ul> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'('</code>or<code>','</code>flags are given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'A'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0041'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'a'</code>. The entire string representing the number will be converted to upper case including the<code>'x'</code>(<tt>'\u0078'</tt>) and<code>'p'</code>(<tt>'\u0070'</tt>and all hexadecimal digits<code>'a'</code>-<code>'f'</code>(<tt>'\u0061'</tt>-<tt>'\u0066'</tt>).</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> All<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">flags</a>defined for Byte, Short, Integer, and Long apply.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<code>'#'</code>flag is given, then the decimal separator will always be present.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If no<a title="Formatter" name="HTML_TO_HH_50526" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="floatdFlags" style="text-decoration:underline; color:rgb(65,100,111)">flags</a>are given the default formatting is as follows:</p> <ul style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The output is right-justified within the<code>width</code> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> Negative numbers begin with a<code>'-'</code> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> Positive numbers and positive zero do not include a sign or extra leading space</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> No grouping separators are included</li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> The decimal separator will only appear if a digit follows it</li> </ul> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<a title="Formatter" name="HTML_TO_HH_50527" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="floatDWidth" style="text-decoration:underline; color:rgb(65,100,111)">width</a>is the minimum number of characters to be written to the output. This includes any signs, digits, grouping separators, decimal separators, exponential symbol, radix indicator, parentheses, and strings representing infinity and NaN as applicable. If the length of the converted value is less than the width then the output will be padded by spaces (<tt>'\u0020'</tt>) until the total number of characters equals width. The padding is on the left by default. If the<code>'-'</code>flag is given then the padding will be on the right. If width is not specified then there is no minimum.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<a title="Formatter" name="HTML_TO_HH_50528" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="floatDPrec" style="text-decoration:underline; color:rgb(65,100,111)">conversion</a>is<code>'e'</code>,<code>'E'</code>or<code>'f'</code>, then the precision is the number of digits after the decimal separator. If the precision is not specified, then it is assumed to be<code>6</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the conversion is<code>'g'</code>or<code>'G'</code>, then the precision is the total number of significant digits in the resulting magnitude after rounding. If the precision is not specified, then the default value is<code>6</code>. If the precision is<code>0</code>, then it is taken to be<code>1</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the conversion is<code>'a'</code>or<code>'A'</code>, then the precision is the number of hexadecimal digits after the decimal separator. If the precision is not provided, then all of the digits as returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Double.toHexString(double)</code></a>will be output.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> <a title="Formatter" name="HTML_TO_HH_50529" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dnbdec" style="text-decoration:underline; color:rgb(65,100,111)"><strong>BigDecimal</strong></a></p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversions may be applied<a title="class in java.math" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigDecimal</code></a>.</p> <table summary="floatConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'e'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0065'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted using<a title="Formatter" name="HTML_TO_HH_50530" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="bscientific" style="text-decoration:underline; color:rgb(65,100,111)">computerized scientific notation</a>. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is positive-zero or negative-zero, then the exponent will be<code>"+00"</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> Otherwise, the result is a string that represents the sign and magnitude (absolute value) of the argument. The formatting of the sign is described in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>. The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> Let<em>n</em>be the unique integer such that 10<sup><em>n</em></sup>&lt;=<em>m</em>&lt; 10<sup><em>n</em>+1</sup>; then let<em>a</em>be the mathematically exact quotient of<em>m</em>and 10<sup><em>n</em></sup>so that 1 &lt;=<em>a</em>&lt; 10. The magnitude is then represented as the integer part of<em>a</em>, as a single decimal digit, followed by the decimal separator followed by decimal digits representing the fractional part of<em>a</em>, followed by the exponent symbol<code>'e'</code>(<tt>'\u0065'</tt>), followed by the sign of the exponent, followed by a representation of<em>n</em>as a decimal integer, as produced by the method<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long.toString(long, int)</code></a>, and zero-padded to include at least two digits.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The number of digits in the result for the fractional part of<em>m</em>or<em>a</em>is equal to the precision. If the precision is not specified then the default value is<code>6</code>. If the precision is less than the number of digits to the right of the decimal point then the value will be rounded using the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">round half up algorithm</a>. Otherwise, zeros may be appended to reach the precision. For a canonical representation of the value, use<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigDecimal.toString()</code></a>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>','</code>flag is given, then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'E'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0045'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'e'</code>. The exponent symbol will be<code>'E'</code>(<tt>'\u0045'</tt>).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'g'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0067'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted in general scientific notation as described below. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> After rounding for the precision, the formatting of the resulting magnitude<em>m</em>depends on its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is greater than or equal to 10<sup>-4</sup>but less than 10<sup>precision</sup>then it is represented in<em><a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">decimal format</a></em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If<em>m</em>is less than 10<sup>-4</sup>or greater than or equal to 10<sup>precision</sup>, then it is represented in<em><a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">computerized scientific notation</a></em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The total number of significant digits in<em>m</em>is equal to the precision. If the precision is not specified, then the default value is<code>6</code>. If the precision is<code>0</code>, then it is taken to be<code>1</code>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> If the<code>'#'</code>flag is given then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'G'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0047'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'g'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'f'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0066'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Requires the output to be formatted using<a title="Formatter" name="HTML_TO_HH_50531" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="bdecimal" style="text-decoration:underline; color:rgb(65,100,111)">decimal format</a>. The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>is applied. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The result is a string that represents the sign and magnitude (absolute value) of the argument. The formatting of the sign is described in the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">localization algorithm</a>. The formatting of the magnitude<em>m</em>depends upon its value.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The magnitude is formatted as the integer part of<em>m</em>, with no leading zeroes, followed by the decimal separator followed by one or more decimal digits representing the fractional part of<em>m</em>.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The number of digits in the result for the fractional part of<em>m</em>or<em>a</em>is equal to the precision. If the precision is not specified then the default value is<code>6</code>. If the precision is less than the number of digits to the right of the decimal point then the value will be rounded using the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">round half up algorithm</a>. Otherwise, zeros may be appended to reach the precision. For a canonical representation of the value, use<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>BigDecimal.toString()</code></a>.</p> </td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> All<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">flags</a>defined for Byte, Short, Integer, and Long apply.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If the<code>'#'</code>flag is given, then the decimal separator will always be present.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default behavior</a>when no flags are given is the same as for Float and Double.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The specification of<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">width</a>and<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">precision</a>is the same as defined for Float and Double.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50532" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="ddt" style="text-decoration:underline; color:rgb(65,100,111)">Date/Time</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> This conversion may be applied to<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>,<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Calendar</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>.</p> <table summary="DTConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'t'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0074'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Prefix for date and time conversion characters.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'T'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0054'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The upper-case variant of<code>'t'</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following date and time conversion character suffixes are defined for the<code>'t'</code>and<code>'T'</code>conversions. The types are similar to but not completely identical to those defined by GNU<code>date</code>and POSIX<code>strftime(3c)</code>. Additional conversion types are provided to access Java-specific functionality (e.g.<code>'L'</code>for milliseconds within the second).</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting times:</p> <table summary="time" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'H'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0048'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e.<code>00 - 23</code>.<code>00</code>corresponds to midnight.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'I'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0049'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e.<code>01 - 12</code>.<code>01</code>corresponds to one o'clock (either morning or afternoon).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'k'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006b'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour of the day for the 24-hour clock, i.e.<code>0 - 23</code>.<code>0</code>corresponds to midnight.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'l'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006c'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Hour for the 12-hour clock, i.e.<code>1 - 12</code>.<code>1</code>corresponds to one o'clock (either morning or afternoon).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'M'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u004d'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Minute within the hour formatted as two digits with a leading zero as necessary, i.e.<code>00 - 59</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'S'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0053'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e.<code>00 - 60</code>("<code>60</code>" is a special value required to support leap seconds).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'L'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u004c'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Millisecond within the second formatted as three digits with leading zeros as necessary, i.e.<code>000 - 999</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'N'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u004e'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Nanosecond within the second, formatted as nine digits with leading zeros as necessary, i.e.<code>000000000 - 999999999</code>. The precision of this value is limited by the resolution of the underlying operating system or hardware.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'p'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0070'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">morning or afternoon</a>marker in lower case, e.g."<code>am</code>" or "<code>pm</code>". Use of the conversion prefix<code>'T'</code>forces this output to upper case. (Note that<code>'p'</code>produces lower-case output. This is different from GNU<code>date</code>and POSIX<code>strftime(3c)</code>which produce upper-case output.)</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'z'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u007a'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <a href="http://www.ietf.org/rfc/rfc0822.txt" style="text-decoration:none; color:rgb(65,100,111)">RFC<wbr>822</wbr></a>style numeric time zone offset from GMT, e.g.<code>-0800</code>. This value will be adjusted as necessary for Daylight Saving Time. For<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>the time zone used is the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default time zone</a>for this instance of the Java virtual machine.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Z'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u005a'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> A string representing the abbreviation for the time zone. This value will be adjusted as necessary for Daylight Saving Time. For<code>long</code>,<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Long</code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>Date</code></a>the time zone used is the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">default time zone</a>for this instance of the Java virtual machine. The Formatter's locale will supersede the locale of the argument (if any).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'s'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0073'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Seconds since the beginning of the epoch starting at 1 January 1970<code>00:00:00</code>UTC, i.e.<code>Long.MIN_VALUE/1000</code>to<code>Long.MAX_VALUE/1000</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Q'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u004f'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Milliseconds since the beginning of the epoch starting at 1 January 1970<code>00:00:00</code>UTC, i.e.<code>Long.MIN_VALUE</code>to<code>Long.MAX_VALUE</code>. The precision of this value is limited by the resolution of the underlying operating system or hardware.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting dates:</p> <table summary="date" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'B'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0042'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">full month name</a>, e.g.<code>"January"</code>,<code>"February"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'b'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0062'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">abbreviated month name</a>, e.g.<code>"Jan"</code>,<code>"Feb"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'h'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0068'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Same as<code>'b'</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'A'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0041'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific full name of the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">day of the week</a>, e.g.<code>"Sunday"</code>,<code>"Monday"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'a'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0061'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Locale-specific short name of the<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">day of the week</a>, e.g.<code>"Sun"</code>,<code>"Mon"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'C'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0043'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Four-digit year divided by<code>100</code>, formatted as two digits with leading zero as necessary, i.e.<code>00 - 99</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'Y'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0059'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Year, formatted to at least four digits with leading zeros as necessary, e.g.<code>0092</code>equals<code>92</code>CE for the Gregorian calendar.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'y'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0079'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Last two digits of the year, formatted with leading zeros as necessary, i.e.<code>00 - 99</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'j'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006a'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of year, formatted as three digits with leading zeros as necessary, e.g.<code>001 - 366</code>for the Gregorian calendar.<code>001</code>corresponds to the first day of the year.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'m'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u006d'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Month, formatted as two digits with leading zeros as necessary, i.e.<code>01 - 13</code>, where "<code>01</code>" is the first month of the year and ("<code>13</code>" is a special value required to support lunar calendars).</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'d'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0064'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of month, formatted as two digits with leading zeros as necessary, i.e.<code>01 - 31</code>, where "<code>01</code>" is the first day of the month.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'e'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0065'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Day of month, formatted as two digits, i.e.<code>1 - 31</code>where "<code>1</code>" is the first day of the month.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The following conversion characters are used for formatting common date/time compositions.</p> <table summary="composites" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'R'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0052'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 24-hour clock as<code>"%tH:%tM"</code> </td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'T'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0054'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 24-hour clock as<code>"%tH:%tM:%tS"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'r'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0072'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Time formatted for the 12-hour clock as<code>"%tI:%tM:%tS %Tp"</code>. The location of the morning or afternoon marker (<code>'%Tp'</code>) may be locale-dependent.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'D'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0044'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Date formatted as<code>"%tm/%td/%ty"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'F'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0046'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <a href="http://www.w3.org/TR/NOTE-datetime" style="text-decoration:none; color:rgb(65,100,111)">ISO<wbr>8601</wbr></a>complete date formatted as<code>"%tY-%tm-%td"</code>.</td> </tr> <tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'c'</code> </td> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <tt>'\u0063'</tt> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> Date and time formatted as<code>"%ta %tb %td %tT %tZ %tY"</code>, e.g.<code>"Sun Jul 20 16:17:00 EDT 1969"</code>.</td> </tr> </tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<code>'-'</code>flag defined for<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">General conversions</a>applies. If the<code>'#'</code>flag is given, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The<a title="Formatter" name="HTML_TO_HH_50533" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dtWidth" style="text-decoration:underline; color:rgb(65,100,111)">width</a>is the minimum number of characters to be written to the output. If the length of the converted value is less than the<code>width</code>then the output will be padded by spaces (<tt>'\u0020'</tt>) until the total number of characters equals width. The padding is on the left by default. If the<code>'-'</code>flag is given then the padding will be on the right. If width is not specified then there is no minimum.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The precision is not applicable. If the precision is specified then an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>will be thrown.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50534" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dper" style="text-decoration:underline; color:rgb(65,100,111)">Percent</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The conversion does not correspond to any argument.</p> <table summary="DTConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody><tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'%'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> The result is a literal<code>'%'</code>(<tt>'\u0025'</tt>) <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The<a title="Formatter" name="HTML_TO_HH_50535" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dtWidth" style="text-decoration:underline; color:rgb(65,100,111)">width</a>is the minimum number of characters to be written to the output including the<code>'%'</code>. If the length of the converted value is less than the<code>width</code>then the output will be padded by spaces (<tt>'\u0020'</tt>) until the total number of characters equals width. The padding is on the left. If width is not specified then just the<code>'%'</code>is output.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The<code>'-'</code>flag defined for<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)">General conversions</a>applies. If any other flags are provided, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>FormatFlagsConversionMis<wbr>matchException</wbr></code></a>will be thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"> The precision is not applicable. If the precision is specified an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>will be thrown.</p> </td> </tr></tbody></table> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50536" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dls" style="text-decoration:underline; color:rgb(65,100,111)">Line Separator</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The conversion does not correspond to any argument.</p> <table summary="DTConv" cellpadding="5" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; line-height:normal"><tbody><tr> <td valign="top" style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> <code>'n'</code> </td> <td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; font-family:Verdana,宋体,sans-serif; line-height:18px"> the platform-specific line separator as returned by<a href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>System.getProperty("line.separator")</code></a>.</td> </tr></tbody></table> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Flags, width, and precision are not applicable. If any are provided an<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatFlagsExcept<wbr>ion</wbr></code></a>,<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatWidthExcept<wbr>ion</wbr></code></a>, and<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>IllegalFormatPrecisionEx<wbr>ception</wbr></code></a>, respectively will be thrown.</p> <h4 style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <a title="Formatter" name="HTML_TO_HH_50537" style="text-decoration:underline; color:rgb(65,100,111)"></a><a name="dpos" style="text-decoration:underline; color:rgb(65,100,111)">Argument Index</a> </h4> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Format specifiers can reference arguments in three ways:</p> <ul style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial"> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> <em>Explicit indexing</em>is used when the format specifier contains an argument index. The argument index is a decimal integer indicating the position of the argument in the argument list. The first argument is referenced by "<code>1$</code>", the second by "<code>2$</code>", etc. An argument may be referenced more than once. <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> For example:</p> <blockquote> <pre style="white-space:normal">formatter.format("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s", "a", "b", "c", "d") // -&gt; "d c b a d c b a"</pre> </blockquote> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> <em>Relative indexing</em>is used when the format specifier contains a<code>'&lt;'</code>(<tt>'\u003c'</tt>) flag which causes the argument for the previous format specifier to be re-used. If there is no previous argument, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>MissingFormatArgumentExc<wbr>eption</wbr></code></a>is thrown. <blockquote> <pre style="white-space:normal">formatter.format("%s %s %&lt;s %&lt;s", "a", "b", "c", "d") // -&gt; "a b b b" // "c" and "d" are ignored because they are not referenced</pre> </blockquote> </li> <li style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:30px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:disc; list-style-position:initial"> <em>Ordinary indexing</em>is used when the format specifier contains neither an argument index nor a<code>'&lt;'</code>flag. Each format specifier which uses ordinary indexing is assigned a sequential implicit index into argument list which is independent of the indices used by explicit or relative indexing. <blockquote> <pre style="white-space:normal">formatter.format("%s %s %s %s", "a", "b", "c", "d") // -&gt; "a b c d"</pre> </blockquote> </li> </ul> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> It is possible to have a format string which uses all forms of indexing, for example:</p> <blockquote> <pre style="white-space:normal">formatter.format("%2$s %s %&lt;s %s", "a", "b", "c", "d") // -&gt; "b a a b" // "c" and "d" are ignored because they are not referenced</pre> </blockquote> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> The maximum number of arguments is limited by the maximum dimension of a Java array as defined by<cite style="font-style:normal">The Java™ Virtual Machine Specification</cite>. If the argument index is does not correspond to an available argument, then a<a title="class in java.util" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>MissingFormatArgumentExc<wbr>eption</wbr></code></a>is thrown.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> If there are more arguments than format specifiers, the extra arguments are ignored.</p> <p style="margin-top:0px; margin-bottom:5px; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:21px"> Unless otherwise specified, passing a<code>null</code>argument to any method or constructor in this class will cause a<a title="class in java.lang" href="http://blog.sina.com.cn/s/blog_a3bf7bd00100xmu6.html" style="text-decoration:none; color:rgb(65,100,111)"><code>NullPointerException</code></a>to be thrown.</p> </wbr>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics