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

📄 javalang.doc6.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title>The Java Language Specification The Package java.lang </title>
</head>
<body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000>
 
<a href="index.html">Contents</a> | <a href="javalang.doc5.html">Prev</a> | <a href="javalang.doc7.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
 
<a name="14348"></a>
<center><h1>20.7  The Class  <code>java.lang.Integer</code></h1></center>
<pre><a name="14361"></a>public final class <code><b>Integer</b></code> extends Number {
<a name="2355"></a>	public static final int <code><b>MIN_VALUE</b></code> = 0x80000000;
<a name="2356"></a>	public static final int <code><b>MAX_VALUE</b></code> = 0x7fffffff;
<a name="2357"></a>	public <code><b>Integer</b></code>(int value);
<a name="2358"></a>	public <code><b>Integer</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2359"></a>	public String <code><b>toString</b></code>();
<a name="2360"></a>	public boolean <code><b>equals</b></code>(Object obj);
<a name="2361"></a>	public int <code><b>hashCode</b></code>();
<a name="2362"></a>	public int <code><b>intValue</b></code>();
<a name="2363"></a>	public long <code><b>longValue</b></code>();
<a name="2364"></a>	public float <code><b>floatValue</b></code>();
<a name="2365"></a>	public double <code><b>doubleValue</b></code>();
<a name="2366"></a>	public static String <code><b>toString</b></code>(int i);
<a name="2367"></a>	public static String <code><b>toString</b></code>(int i, int radix);
<a name="7371"></a>	public static String <code><b>toHexString</b></code>(long i);
<a name="7372"></a>	public static String <code><b>toOctalString</b></code>(long i);
<a name="7373"></a>	public static String <code><b>toBinaryString</b></code>(long i);
<a name="2431"></a>	public static int <code><b>parseInt</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2368"></a>	public static int <code><b>parseInt</b></code>(String s, int radix)<br>
		throws NumberFormatException;
<a name="2371"></a>	public static Integer <code><b>valueOf</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2437"></a>	public static Integer <code><b>valueOf</b></code>(String s, int radix)<br>
		throws NumberFormatException;
<a name="2372"></a>	public static Integer <code><b>getInteger</b></code>(String nm);
<a name="2373"></a>	public static Integer <code><b>getInteger</b></code>(String nm, int val);
<a name="2389"></a>	public static Integer <code><b>getInteger</b></code>(String nm, Integer val);
<a name="2394"></a>}
</pre><a name="2390"></a>
<p><font size=+1><strong>20.7.1   </strong> <code>public static final int <code><b>MIN_VALUE</b></code> = 0x80000000;</code></font>
<p>
<a name="3467"></a>
The constant value of this field is <code>-2147483648</code>, the lowest value of type <code>int</code>.
<p><a name="2391"></a>
<p><font size=+1><strong>20.7.2   </strong> <code>public static final int <code><b>MAX_VALUE</b></code> = 0x7fffffff;</code></font>
<p>
<a name="3471"></a>
The constant value of this field is <code>2147483647</code>, the highest value of type <code>int</code>.
<p><a name="1327"></a>
<p><font size=+1><strong>20.7.3   </strong> <code>public <code><b>Integer</b></code>(int value)</code></font>
<p>
<a name="3659"></a>
This constructor initializes a newly created <code>Integer</code> object so that it represents 
the primitive value that is the argument.
<p><a name="1328"></a>
<p><font size=+1><strong>20.7.4   </strong> <code>public <code><b>Integer</b></code>(String s) 	throws NumberFormatException</code></font>
<p>
<a name="3711"></a>
This constructor initializes a newly created <code>Integer</code> object so that it represents 
the integer represented by the string in decimal form. The string is converted to an 
<code>int</code> in exactly the manner used by the <code>parseInt</code> method <a href="javalang.doc6.html#4930">(&#167;20.7.18)</a> for radix 10.
<p><a name="3709"></a>
<p><font size=+1><strong>20.7.5   </strong> <code>public String <code><b>toString</b></code>()</code></font>
<p>
<a name="1346"></a>
The integer value represented by this <code>Integer</code> object is converted to signed decimal
representation and returned as a string, exactly as if the integer value were 
given as an argument to the <code>toString</code> method that takes one argument <a href="javalang.doc6.html#1459">(&#167;20.7.12)</a>.
<p><a name="3950"></a>
Overrides the <code>toString</code> method of <code>Object</code> <a href="javalang.doc1.html#1152">(&#167;20.1.2)</a>.<p>
<a name="3797"></a>
<p><font size=+1><strong>20.7.6   </strong> <code>public boolean <code><b>equals</b></code>(Object obj)</code></font>
<p>
<a name="4624"></a>
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 represents the same <code>int</code> value as this <code>Integer</code> object.
<p><a name="4002"></a>
Overrides the <code>equals</code> method of <code>Object</code> <a href="javalang.doc1.html#14865">(&#167;20.1.3)</a>.<p>
<a name="4207"></a>
<p><font size=+1><strong>20.7.7   </strong> <code>public int <code><b>hashCode</b></code>()</code></font>
<p>
<a name="4678"></a>
The result is the primitive <code>int</code> value represented by this <code>Integer</code> object.
<p><a name="4211"></a>
Overrides the <code>hashCode</code> method of <code>Object</code> <a href="javalang.doc1.html#13784">(&#167;20.1.4)</a>.<p>
<a name="4213"></a>
<p><font size=+1><strong>20.7.8   </strong> <code>public int <code><b>intValue</b></code>()</code></font>
<p>
<a name="4429"></a>
The <code>int</code> value represented by this <code>Integer</code> object is returned.
<p><a name="4234"></a>
Overrides the <code>intValue</code> method of <code>Number</code> <a href="javalang.doc5.html#3376">(&#167;20.6.1)</a>.<p>
<a name="1330"></a>
<p><font size=+1><strong>20.7.9   </strong> <code>public long <code><b>longValue</b></code>()</code></font>
<p>
<a name="4431"></a>
The <code>int</code> value represented by this <code>Integer</code> object is converted <a href="5.doc.html#25222">(&#167;5.1.2)</a> to type 
<code>long</code> and the result of the conversion is returned.
<p><a name="4426"></a>
Overrides the <code>longValue</code> method of <code>Number</code> <a href="javalang.doc5.html#3434">(&#167;20.6.2)</a>.<p>
<a name="1331"></a>
<p><font size=+1><strong>20.7.10   </strong> <code>public float <code><b>floatValue</b></code>()</code></font>
<p>
<a name="4461"></a>
The <code>int</code> value represented by this <code>Integer</code> object is converted <a href="5.doc.html#25222">(&#167;5.1.2)</a> to type 
<code>float</code> and the result of the conversion is returned.
<p><a name="4417"></a>
Overrides the <code>floatValue</code> method of <code>Number</code> <a href="javalang.doc5.html#3384">(&#167;20.6.3)</a>.<p>
<a name="1332"></a>
<p><font size=+1><strong>20.7.11   </strong> <code>public double <code><b>doubleValue</b></code>()</code></font>
<p>
<a name="4468"></a>
The <code>int</code> value represented by this <code>Integer</code> object is converted <a href="5.doc.html#25222">(&#167;5.1.2)</a> to type 
<code>double</code> and the result of the conversion is returned.
<p><a name="4408"></a>
Overrides the <code>doubleValue</code> method of <code>Number</code> <a href="javalang.doc5.html#3412">(&#167;20.6.4)</a>.<p>
<a name="1459"></a>
<p><font size=+1><strong>20.7.12   </strong> <code>public static String <code><b>toString</b></code>(int i)</code></font>
<p>
<a name="3806"></a>
The argument is converted to signed decimal representation and returned as a 
string, exactly as if the argument and the radix <code>10</code> were given as arguments to the 
<code>toString</code> method that takes two arguments <a href="javalang.doc6.html#1460">(&#167;20.7.13)</a>.
<p><a name="1460"></a>
<p><font size=+1><strong>20.7.13   </strong> <code>public static String <code><b>toString</b></code>(int i, int radix)</code></font>
<p>
<a name="3824"></a>
The first argument is converted to a signed representation in the radix specified by 
the second argument; this representation is returned as a string.
<p><a name="24639"></a>
If the <code>radix</code> is smaller than <code>Character.MIN_RADIX</code> <a href="javalang.doc4.html#1300">(&#167;20.5.3)</a> or larger than <code>Character.MAX_RADIX</code> <a href="javalang.doc4.html#1311">(&#167;20.5.4)</a>, then the value <code>10</code> is used instead.<p>
<a name="3838"></a>
If the first argument is negative, the first character of the result will be the character <code>'-'</code> (<code>'\u002d'</code>). If the first argument is not negative, no sign character appears in the result.<p>
<a name="3891"></a>
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 <code>'0'</code> (<code>'\u0030'</code>); otherwise, the first character of the representation of the magnitude will not be the zero character.The following ASCII characters are used as digits:<p>
<pre><a name="3892"></a><code>0123456789abcdefghijklmnopqrstuvwxyz
</code></pre><a name="3893"></a>
These are <code>'\u0030'</code> through <code>'\u0039'</code> and <code>'\u0061'</code> through <code>'\u007a'</code>. If the 
<code>radix</code> is <i>N</i>, then the first <i>N</i> of these characters are used as radix-<i>N</i> digits in the 
order shown. Thus, the digits for hexadecimal (radix 16) are <code>0123456789abcdef</code>. 
If uppercase letters are desired, the <code>toUpperCase</code> method <a href="javalang.doc11.html#14011">(&#167;20.12.36)</a> of class 
<code>String</code> may be called on the result:
<p><pre><a name="3897"></a>Integer.toString(n, 16).toUpperCase()
</pre><a name="7332"></a>
<p><font size=+1><strong>20.7.14   </strong> <code>public static String <code><b>toHexString</b></code>(int i)</code></font>
<p>
<a name="7333"></a>
The argument is converted to an unsigned representation in hexadecimal radix 
(base 16); this representation is returned as a string.
<p><a name="7334"></a>
The result represents the unsigned magnitude of the argument. This equals the argument plus <img src="javalang.doc.anc45.gif">if the argument is negative; otherwise, it equals the argument.<p>
<a name="7338"></a>

⌨️ 快捷键说明

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