📄 integer.html
字号:
<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>'\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>
<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> 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>'\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>
<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> s, int 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>
<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> 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>
<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>Returns:</B><DD>the value of this Integer as a byte.<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>Returns:</B><DD>the value of this Integer as a short.<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>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>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="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE>
<DL>
<DD>Returns a String object representing this Integer's value. The value is converted to signed decimal representation and returned as a string, exactly as if the integer value were given as an argument to the <A HREF="../../java/lang/Integer.html#toString(int)"><CODE>toString(int)</CODE></A> method.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a string representation of the value of this object in base 10.</DL>
</DD>
</DL>
<HR>
<A NAME="hashCode()"><!-- --></A><H3>
hashCode</H3>
<PRE>
public int <B>hashCode</B>()</PRE>
<DL>
<DD>Returns a hashcode for this Integer.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a hash code value for this object, equal to the primitive <tt>int</tt> value represented by this <tt>Integer</tt> object.</DL>
</DD>
</DL>
<HR>
<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A> obj)</PRE>
<DL>
<DD>Compares this object to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is an <code>Integer</code> object that contains the same <code>int</code> value as this object.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to compare with.<DT><B>Returns:</B><DD><code>true</code> if the objects are the same; <code>false</code> otherwise.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Integer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Class.html"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Long.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Integer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<font size="-1"><a href="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -