📄 integer.html
字号:
</TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> short</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#shortValue()">shortValue</A></B>()</CODE><BR> Returns the value of this Integer as a short.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#toBinaryString(int)">toBinaryString</A></B>(int i)</CODE><BR> Creates a string representation of the integer argument as an unsigned integer in base 2.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#toHexString(int)">toHexString</A></B>(int i)</CODE><BR> Creates a string representation of the integer argument as an unsigned integer in base 16.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#toOctalString(int)">toOctalString</A></B>(int i)</CODE><BR> Creates a string representation of the integer argument as an unsigned integer in base 8.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#toString()">toString</A></B>()</CODE><BR> Returns a String object representing this Integer's value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#toString(int)">toString</A></B>(int i)</CODE><BR> Returns a new String object representing the specified integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><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#clone()">clone</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <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><HR><A NAME="TYPE"><!-- --></A><H3>TYPE</H3><PRE>public static final <A HREF="../../java/lang/Class.html">Class</A> <B>TYPE</B></PRE><DL><DD>The Class object representing the primitive type int.<DD><DL><DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></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><HR><A NAME="Integer(java.lang.String)"><!-- --></A><H3>Integer</H3><PRE>public <B>Integer</B>(<A HREF="../../java/lang/String.html">String</A> s) throws <A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></PRE><DL><DD>Constructs a newly allocated <code>Integer</code> object that represents the value represented by the string. The string is converted to an <tt>int</tt> in exactly the manner used by the <tt>parseInt</tt> method for radix 10.<DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the <code>String</code> to be converted to an <code>Integer</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></CODE> - if the <code>String</code> does not contain a parsable integer.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Integer.html#parseInt(java.lang.String, int)"><CODE>parseInt(java.lang.String, int)</CODE></A></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> digets in the order shown. Thus, the digits for hexadecimal (radix 16) are <tt>0123456789abcdef</tt>. If uppercase letters are desired, the <A HREF="../../java/lang/String.html#toUpperCase()"><CODE>String.toUpperCase()</CODE></A> method may be called on the result: <blockquote><pre> Integer.toString(n, 16).toUpperCase() </pre></blockquote><DD><DL></DL></DD><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>. If the uppercase letters are desired, the <A HREF="../../java/lang/String.html#toUpperCase()"><CODE>String.toUpperCase()</CODE></A> method may be called on the result: <blockquote><pre> Long.toHexString(n).toUpperCase() </pre></blockquote><DD><DL></DL></DD><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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -