📄 integer.html
字号:
<TD><CODE><B><A HREF="../../java/lang/Integer.html#toString(int, int)">toString</A></B>(int i, int radix)</CODE>
<BR>
Creates a string representation of the first argument in the radix specified by the second argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../java/lang/Integer.html">Integer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Integer.html#valueOf(java.lang.String)">valueOf</A></B>(<A HREF="../../java/lang/String.html">String</A> s)</CODE>
<BR>
Returns a new Integer object initialized to the value of the specified String.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../java/lang/Integer.html">Integer</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Integer.html#valueOf(java.lang.String, int)">valueOf</A></B>(<A HREF="../../java/lang/String.html">String</A> s, int radix)</CODE>
<BR>
Returns a new Integer object initialized to the value of the specified String.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="MIN_VALUE"><!-- --></A><H3>
MIN_VALUE</H3>
<PRE>
public static final int <B>MIN_VALUE</B></PRE>
<DL>
<DD>The smallest value of type <code>int</code>. The constant value of this field is <tt>-2147483648</tt>.</DL>
<HR>
<A NAME="MAX_VALUE"><!-- --></A><H3>
MAX_VALUE</H3>
<PRE>
public static final int <B>MAX_VALUE</B></PRE>
<DL>
<DD>The largest value of type <code>int</code>. The constant value of this field is <tt>2147483647</tt>.</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Integer(int)"><!-- --></A><H3>
Integer</H3>
<PRE>
public <B>Integer</B>(int value)</PRE>
<DL>
<DD>Constructs a newly allocated <code>Integer</code> object that represents the primitive <code>int</code> argument.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to be represented by the <code>Integer</code>.</DL>
</DD>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="toString(int, int)"><!-- --></A><H3>
toString</H3>
<PRE>
public static <A HREF="../../java/lang/String.html">String</A> <B>toString</B>(int i, int radix)</PRE>
<DL>
<DD>Creates a string representation of the first argument in the radix specified by the second argument. <p> If the radix is smaller than <code>Character.MIN_RADIX</code> or larger than <code>Character.MAX_RADIX</code>, then the radix <code>10</code> is used instead. <p> If the first argument is negative, the first element of the result is the ASCII minus character <code>'-'</code> (<tt>'\u002d'</tt>). If the first argument is not negative, no sign character appears in the result. <p> The remaining characters of the result represent the magnitude of the first argument. If the magnitude is zero, it is represented by a single zero character <tt>'0'</tt> (<tt>'\u0030'</tt>); otherwise, the first character of the representation of the magnitude will not be the zero character. The following ASCII characters are used as digits: <blockquote><pre> 0123456789abcdefghijklmnopqrstuvwxyz </pre></blockquote> These are <tt>'\u0030'</tt> through <tt>'\u0039'</tt> and <tt>'\u0061'</tt> through <tt>'\u007a'</tt>. If the <tt>radix</tt> is <var>N</var>, then the first <var>N</var> of these characters are used as radix-<var>N</var> digits in the order shown. Thus, the digits for hexadecimal (radix 16) are <blockquote><pre> <tt>0123456789abcdef</tt>. </pre></blockquote><DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an integer.<DD><CODE>radix</CODE> - the radix.<DT><B>Returns:</B><DD>a string representation of the argument in the specified radix.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Character.html#MAX_RADIX"><CODE>Character.MAX_RADIX</CODE></A>,
<A HREF="../../java/lang/Character.html#MIN_RADIX"><CODE>Character.MIN_RADIX</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="toHexString(int)"><!-- --></A><H3>
toHexString</H3>
<PRE>
public static <A HREF="../../java/lang/String.html">String</A> <B>toHexString</B>(int i)</PRE>
<DL>
<DD>Creates a string representation of the integer argument as an unsigned integer in base 16. <p> The unsigned integer value is the argument plus 2<sup>32</sup> if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading <code>0</code>s. If the unsigned magnitude is zero, it is represented by a single zero character <tt>'0'</tt> (<tt>'\u0030'</tt>); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits: <blockquote><pre> 0123456789abcdef </pre></blockquote> These are the characters <tt>'\u0030'</tt> through <tt>'\u0039'</tt> and <tt>'u\0039'</tt> through <tt>'\u0066'</tt>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an integer.<DT><B>Returns:</B><DD>the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16).<DT><B>Since: </B><DD>JDK1.0.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="toOctalString(int)"><!-- --></A><H3>
toOctalString</H3>
<PRE>
public static <A HREF="../../java/lang/String.html">String</A> <B>toOctalString</B>(int i)</PRE>
<DL>
<DD>Creates a string representation of the integer argument as an unsigned integer in base 8. <p> The unsigned integer value is the argument plus 2<sup>32</sup> if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading <code>0</code>s. <p> If the unsigned magnitude is zero, it is represented by a single zero character <tt>'0'</tt> (<tt>'\u0030'</tt>); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The octal digits are: <blockquote><pre> 01234567 </pre></blockquote> These are the characters <tt>'\u0030'</tt> through <tt>'\u0037'</tt>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an integer<DT><B>Returns:</B><DD>the string representation of the unsigned integer value represented by the argument in octal (base 8).<DT><B>Since: </B><DD>JDK1.0.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="toBinaryString(int)"><!-- --></A><H3>
toBinaryString</H3>
<PRE>
public static <A HREF="../../java/lang/String.html">String</A> <B>toBinaryString</B>(int i)</PRE>
<DL>
<DD>Creates a string representation of the integer argument as an unsigned integer in base 2. <p> The unsigned integer value is the argument plus 2<sup>32</sup>if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading <code>0</code>s. If the unsigned magnitude is zero, it is represented by a single zero character <tt>'0'</tt> (<tt>'\u0030'</tt>); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The characters <tt>'0'</tt> (<tt>'\u0030'</tt>) and <tt>'1'</tt> (<tt>'\u0031'</tt>) are used as binary digits.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an integer.<DT><B>Returns:</B><DD>the string representation of the unsigned integer value represented by the argument in binary (base 2).<DT><B>Since: </B><DD>JDK1.0.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="toString(int)"><!-- --></A><H3>
toString</H3>
<PRE>
public static <A HREF="../../java/lang/String.html">String</A> <B>toString</B>(int i)</PRE>
<DL>
<DD>Returns a new String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string, exactly as if the argument and radix <tt>10</tt> were given as arguments to the <A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>toString(int, int)</CODE></A> method.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - an integer to be converted.<DT><B>Returns:</B><DD>a string representation of the argument in base 10.</DL>
</DD>
</DL>
<HR>
<A NAME="parseInt(java.lang.String, int)"><!-- --></A><H3>
parseInt</H3>
<PRE>
public static int <B>parseInt</B>(<A HREF="../../java/lang/String.html">String</A> s, int radix) throws <A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></PRE>
<DL>
<DD>Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether <A HREF="../../java/lang/Character.html#digit(char, int)"><CODE>Character.digit(char, int)</CODE></A> returns a nonnegative value), except that the first character may be an ASCII minus sign <code>'-'</code> (<code>'\u002d'</code>) to indicate a negative value. The resulting integer value is returned. <p> An exception of type <tt>NumberFormatException</tt> is thrown if any of the following situations occurs:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -