📄 integer.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:03 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Integer</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/lang/InheritableThreadLocal.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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.lang</FONT><BR>Class Integer</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../java/lang/Number.html">java.lang.Number</A> | +--<B>java.lang.Integer</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/lang/Comparable.html">Comparable</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public final class <B>Integer</B><DT>extends <A HREF="../../java/lang/Number.html">Number</A><DT>implements <A HREF="../../java/lang/Comparable.html">Comparable</A></DL><P>The Integer class wraps a value of the primitive type <code>int</code> in an object. An object of type <code>Integer</code> contains a single field whose type is <code>int</code>. <p> In addition, this class provides several methods for converting an <code>int</code> to a <code>String</code> and a <code>String</code> to an <code>int</code>, as well as other constants and methods useful when dealing with an <code>int</code>.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#java.lang.Integer">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#MAX_VALUE">MAX_VALUE</A></B></CODE><BR> The largest value of type <code>int</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#MIN_VALUE">MIN_VALUE</A></B></CODE><BR> The smallest value of type <code>int</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#TYPE">TYPE</A></B></CODE><BR> The Class object representing the primitive type int.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/Integer.html#Integer(int)">Integer</A></B>(int value)</CODE><BR> Constructs a newly allocated <code>Integer</code> object that represents the primitive <code>int</code> argument.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/lang/Integer.html#Integer(java.lang.String)">Integer</A></B>(<A HREF="../../java/lang/String.html">String</A> s)</CODE><BR> Constructs a newly allocated <code>Integer</code> object that represents the value represented by the string.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> byte</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#byteValue()">byteValue</A></B>()</CODE><BR> Returns the value of this Integer as a byte.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#compareTo(java.lang.Integer)">compareTo</A></B>(<A HREF="../../java/lang/Integer.html">Integer</A> anotherInteger)</CODE><BR> Compares two Integers numerically.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#compareTo(java.lang.Object)">compareTo</A></B>(<A HREF="../../java/lang/Object.html">Object</A> o)</CODE><BR> Compares this Integer to another Object.</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#decode(java.lang.String)">decode</A></B>(<A HREF="../../java/lang/String.html">String</A> nm)</CODE><BR> Decodes a <code>String</code> into an <code>Integer</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> double</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#doubleValue()">doubleValue</A></B>()</CODE><BR> Returns the value of this Integer as a <tt>double</tt>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html">Object</A> obj)</CODE><BR> Compares this object to the specified object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#floatValue()">floatValue</A></B>()</CODE><BR> Returns the value of this Integer as a <tt>float</tt>.</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#getInteger(java.lang.String)">getInteger</A></B>(<A HREF="../../java/lang/String.html">String</A> nm)</CODE><BR> Determines the integer value of the system property with the specified name.</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#getInteger(java.lang.String, int)">getInteger</A></B>(<A HREF="../../java/lang/String.html">String</A> nm, int val)</CODE><BR> Determines the integer value of the system property with the specified name.</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#getInteger(java.lang.String, java.lang.Integer)">getInteger</A></B>(<A HREF="../../java/lang/String.html">String</A> nm, <A HREF="../../java/lang/Integer.html">Integer</A> val)</CODE><BR> Returns the integer value of the system property with the specified name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#hashCode()">hashCode</A></B>()</CODE><BR> Returns a hashcode for this Integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#intValue()">intValue</A></B>()</CODE><BR> Returns the value of this Integer as an int.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#longValue()">longValue</A></B>()</CODE><BR> Returns the value of this Integer as a <tt>long</tt>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#parseInt(java.lang.String)">parseInt</A></B>(<A HREF="../../java/lang/String.html">String</A> s)</CODE><BR> Parses the string argument as a signed decimal integer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/Integer.html#parseInt(java.lang.String, int)">parseInt</A></B>(<A HREF="../../java/lang/String.html">String</A> s, int radix)</CODE><BR> Parses the string argument as a signed integer in the radix specified by the second argument.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -