⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 integer.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 4 页
字号:
</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 octal (base&nbsp;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&nbsp;i)</PRE><DL><DD>Creates a string representation of the integer argument as an unsigned integer in base&nbsp;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&nbsp;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>'&#92;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>'&#92;u0030'</tt>) and <tt>'1'</tt> (<tt>'&#92;u0031'</tt>) are used  as binary digits.<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 binary (base&nbsp;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&nbsp;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></DL></DD><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&nbsp;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>&nbsp;s,                           int&nbsp;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>'&#92;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: <ul> <li>The first argument is <tt>null</tt> or is a string of length zero.  <li>The radix is either smaller than  <A HREF="../../java/lang/Character.html#MIN_RADIX"><CODE>Character.MIN_RADIX</CODE></A> or larger than <A HREF="../../java/lang/Character.html#MAX_RADIX"><CODE>Character.MAX_RADIX</CODE></A>.  <li>Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign <tt>'-'</tt>  (<tt>'&#92;u002d'</tt>) provided that the string is longer than length 1.  <li>The integer value represented by the string is not a value of type <tt>int</tt>.  </ul><p> Examples: <blockquote><pre> parseInt("0", 10) returns 0 parseInt("473", 10) returns 473 parseInt("-0", 10) returns 0 parseInt("-FF", 16) returns -255 parseInt("1100110", 2) returns 102 parseInt("2147483647", 10) returns 2147483647 parseInt("-2147483648", 10) returns -2147483648 parseInt("2147483648", 10) throws a NumberFormatException parseInt("99", 8) throws a NumberFormatException parseInt("Kona", 10) throws a NumberFormatException parseInt("Kona", 27) returns 411787 </pre></blockquote><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the <code>String</code> containing the integer.<DD><CODE>radix</CODE> - the radix to be used.<DT><B>Returns:</B><DD>the integer represented by the string argument in the             specified radix.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></CODE> - if the string does not contain a               parsable integer.</DL></DD></DL><HR><A NAME="parseInt(java.lang.String)"><!-- --></A><H3>parseInt</H3><PRE>public static int <B>parseInt</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;s)                    throws <A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></PRE><DL><DD>Parses the string argument as a signed decimal integer. The  characters in the string must all be decimal digits, except that  the first character may be an ASCII minus sign <code>'-'</code>  (<tt>'&#92;u002d'</tt>) to indicate a negative value. The resulting  integer value is returned, exactly as if the argument and the radix  10 were given as arguments to the  <A HREF="../../java/lang/Integer.html#parseInt(java.lang.String, int)"><CODE>parseInt(java.lang.String, int)</CODE></A> method.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - a string.<DT><B>Returns:</B><DD>the integer represented by the argument in decimal.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></CODE> - if the string does not contain a               parsable integer.</DL></DD></DL><HR><A NAME="valueOf(java.lang.String, int)"><!-- --></A><H3>valueOf</H3><PRE>public static <A HREF="../../java/lang/Integer.html">Integer</A> <B>valueOf</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;s,                              int&nbsp;radix)                       throws <A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></PRE><DL><DD>Returns a new Integer object initialized to the value of the specified String. The first argument is interpreted as representing  a signed integer in the radix specified by the second argument,  exactly as if the arguments were given to the  <A HREF="../../java/lang/Integer.html#parseInt(java.lang.String, int)"><CODE>parseInt(java.lang.String, int)</CODE></A> method. The result is an  <code>Integer</code> object that represents the integer value  specified by the string.  <p> In other words, this method returns an <code>Integer</code> object  equal to the value of: <blockquote><pre> new Integer(Integer.parseInt(s, radix))   </pre></blockquote><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to be parsed.<DD><CODE>radix</CODE> - the radix of the integer represented by string              <tt>s</tt><DT><B>Returns:</B><DD>a newly constructed <code>Integer</code> initialized to the             value represented by the string argument in the specified             radix.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></CODE> - if the String cannot be              parsed as an <code>int</code>.</DL></DD></DL><HR><A NAME="valueOf(java.lang.String)"><!-- --></A><H3>valueOf</H3><PRE>public static <A HREF="../../java/lang/Integer.html">Integer</A> <B>valueOf</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;s)                       throws <A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></PRE><DL><DD>Returns a new Integer object initialized to the value of the specified String. The argument is interpreted as representing a  signed decimal integer, exactly as if the argument were given to  the <A HREF="../../java/lang/Integer.html#parseInt(java.lang.String)"><CODE>parseInt(java.lang.String)</CODE></A> method. The result is an  <tt>Integer</tt> object that represents the integer value specified  by the string.  <p> In other words, this method returns an <tt>Integer</tt> object equal  to the value of: <blockquote><pre> new Integer(Integer.parseInt(s))  </pre></blockquote><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to be parsed.<DT><B>Returns:</B><DD>a newly constructed <code>Integer</code> initialized to the             value represented by the string argument.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NumberFormatException.html">NumberFormatException</A></CODE> - if the string cannot be parsed              as an integer.</DL></DD></DL><HR><A NAME="byteValue()"><!-- --></A><H3>byteValue</H3><PRE>public byte <B>byteValue</B>()</PRE><DL><DD>Returns the value of this Integer as a byte.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#byteValue()">byteValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="shortValue()"><!-- --></A><H3>shortValue</H3><PRE>public short <B>shortValue</B>()</PRE><DL><DD>Returns the value of this Integer as a short.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#shortValue()">shortValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="intValue()"><!-- --></A><H3>intValue</H3><PRE>public int <B>intValue</B>()</PRE><DL><DD>Returns the value of this Integer as an int.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#intValue()">intValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>int</code> value represented by this object.</DL></DD></DL><HR><A NAME="longValue()"><!-- --></A><H3>longValue</H3><PRE>public long <B>longValue</B>()</PRE><DL><DD>Returns the value of this Integer as a <tt>long</tt>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#longValue()">longValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>int</code> value represented by this object that is          converted to type <code>long</code> and the result of the          conversion is returned.</DL></DD></DL><HR><A NAME="floatValue()"><!-- --></A><H3>floatValue</H3><PRE>public float <B>floatValue</B>()</PRE><DL><DD>Returns the value of this Integer as a <tt>float</tt>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#floatValue()">floatValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>int</code> value represented by this object is          converted to type <code>float</code> and the result of the          conversion is returned.</DL></DD></DL><HR><A NAME="doubleValue()"><!-- --></A><H3>doubleValue</H3><PRE>public double <B>doubleValue</B>()</PRE><DL><DD>Returns the value of this Integer as a <tt>double</tt>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#doubleValue()">doubleValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>int</code> value represented by this object is          converted to type <code>double</code> and the result of the          conversion is returned.</DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -