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

📄 javalang.doc7.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.doc6.html">Prev</a> | <a href="javalang.doc8.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
 
<a name="46750"></a>
<center><h1>20.8  The Class  <code>java.lang.Long</code></h1></center>
<pre><a name="46751"></a>public final class <code><b>Long</b></code> extends Number {
<a name="2405"></a>	public static final long <code><b>MIN_VALUE</b></code> = 0x8000000000000000L;
<a name="2406"></a>	public static final long <code><b>MAX_VALUE</b></code> = 0x7fffffffffffffffL;
<a name="2407"></a>	public <code><b>Long</b></code>(long value);
<a name="2408"></a>	public <code><b>Long</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2409"></a>	public String <code><b>toString</b></code>();
<a name="2410"></a>	public boolean <code><b>equals</b></code>(Object obj);
<a name="2411"></a>	public int <code><b>hashCode</b></code>();
<a name="2412"></a>	public int <code><b>intValue</b></code>();
<a name="2413"></a>	public long <code><b>longValue</b></code>();
<a name="2414"></a>	public float <code><b>floatValue</b></code>();
<a name="2415"></a>	public double <code><b>doubleValue</b></code>();
<a name="2416"></a>	public static String <code><b>toString</b></code>(long i);
<a name="2417"></a>	public static String <code><b>toString</b></code>(long i, int radix);
<a name="7185"></a>	public static String <code><b>toHexString</b></code>(long i);
<a name="7189"></a>	public static String <code><b>toOctalString</b></code>(long i);
<a name="7193"></a>	public static String <code><b>toBinaryString</b></code>(long i);
<a name="2418"></a>	public static long <code><b>parseLong</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2462"></a>	public static long <code><b>parseLong</b></code>(String s, int radix)<br>
		throws NumberFormatException;
<a name="2467"></a>	public static Long <code><b>valueOf</b></code>(String s)<br>
		throws NumberFormatException;
<a name="2473"></a>	public static Long <code><b>valueOf</b></code>(String s, int radix)<br>
		throws NumberFormatException;
<a name="2422"></a>	public static Long <code><b>getLong</b></code>(String nm);
<a name="2423"></a>	public static Long <code><b>getLong</b></code>(String nm, long val);
<a name="2424"></a>	public static Long <code><b>getLong</b></code>(String nm, Long val);
<a name="2427"></a>}
</pre><a name="2397"></a>
<p><font size=+1><strong>20.8.1   </strong> <code>public static final long <code><b>MIN_VALUE</b></code> = 0x8000000000000000L;</code></font>
<p>
<a name="3482"></a>
The constant value of this field is the lowest value of type <code>long</code>.
<p><a name="14434"></a>
<p><font size=+1><strong>20.8.2   </strong> <code>public static final long <code><b>MAX_VALUE</b></code> = 0x7fffffffffffffffL;</code></font>
<p>
<a name="3486"></a>
The constant value of this field is the highest value of type <code>long</code>.
<p><a name="1388"></a>
<p><font size=+1><strong>20.8.3   </strong> <code>public <code><b>Long</b></code>(long value)</code></font>
<p>
<a name="3667"></a>
This constructor initializes a newly created <code>Long</code> object so that it represents the 
primitive value that is the argument.
<p><a name="1389"></a>
<p><font size=+1><strong>20.8.4   </strong> <code>public <code><b>Long</b></code>(String s) throws NumberFormatException</code></font>
<p>
<a name="3737"></a>
This constructor initializes a newly created <code>Long</code> object so that it represents the 
integer represented by the string in decimal form. The string is converted to a 
<code>long</code> value in exactly the manner used by the <code>parseLong</code> method <a href="javalang.doc7.html#14437">(&#167;20.8.17)</a> for 
radix 10.
<p><a name="1390"></a>
<p><font size=+1><strong>20.8.5   </strong> <code>public String <code><b>toString</b></code>()</code></font>
<p>
<a name="3933"></a>
The <code>long</code> integer value represented by this <code>Long</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="3957"></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="1391"></a>
<p><font size=+1><strong>20.8.6   </strong> <code>public boolean <code><b>equals</b></code>(Object obj)</code></font>
<p>
<a name="4634"></a>
The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>Long</code> object that 
represents the same <code>long</code> value as this <code>Long</code> object.
<p><a name="3995"></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="1392"></a>
<p><font size=+1><strong>20.8.7   </strong> <code>public int <code><b>hashCode</b></code>()</code></font>
<p>
<a name="4714"></a>
The result is the exclusive OR of the two halves of the primitive <code>long</code> value represented
by this <code>Long</code> object. That is, the hashcode is the value of the expression:
<p><pre><a name="4715"></a>(int)(this.longValue()^(this.longValue()&gt;&gt;&gt;32))
</pre><a name="4719"></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="1393"></a>
<p><font size=+1><strong>20.8.8   </strong> <code>public int <code><b>intValue</b></code>()</code></font>
<p>
<a name="4506"></a>
The <code>long</code> value represented by this <code>Long</code> object is converted <a href="5.doc.html#175672">(&#167;5.1.3)</a> to type <code>int</code> 
and the result of the conversion is returned.
<p><a name="4265"></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="1394"></a>
<p><font size=+1><strong>20.8.9   </strong> <code>public long <code><b>longValue</b></code>()</code></font>
<p>
<a name="4479"></a>
The <code>long</code> value represented by this <code>Long</code> object is returned.
<p><a name="4399"></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="1395"></a>
<p><font size=+1><strong>20.8.10   </strong> <code>public float <code><b>floatValue</b></code>()</code></font>
<p>
<a name="4521"></a>
The <code>long</code> value represented by this <code>Long</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="4390"></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="1396"></a>
<p><font size=+1><strong>20.8.11   </strong> <code>public double <code><b>doubleValue</b></code>()</code></font>
<p>
<a name="4528"></a>
The <code>long</code> value represented by this <code>Long</code> object is converted <a href="5.doc.html#25222">(&#167;5.1.2)</a> to type 
<code>double</code> &#32;and the result of the conversion is returned.
<p><a name="4381"></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="1452"></a>
<p><font size=+1><strong>20.8.12   </strong> <code>public static String <code><b>toString</b></code>(long i)</code></font>
<p>
<a name="3925"></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.doc7.html#1453">(&#167;20.8.13)</a>.
<p><a name="1453"></a>
<p><font size=+1><strong>20.8.13   </strong> <code>public static String <code><b>toString</b></code>(long i, int radix)</code></font>
<p>
<a name="3901"></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="24775"></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="24783"></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="24784"></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="24786"></a><code>0123456789abcdefghijklmnopqrstuvwxyz
</code></pre><a name="3908"></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="3916"></a>Long.toString(n, 16).toUpperCase()
</pre><a name="7198"></a>
<p><font size=+1><strong>20.8.14   </strong> <code>public static String <code><b>toHexString</b></code>(long i)</code></font>
<p>
<a name="7204"></a>
The argument is converted to an unsigned representation in hexadecimal radix 
(base 16); this representation is returned as a string.
<p><a name="7212"></a>
The result represents the unsigned magnitude of the argument. This equals the argument plus <img src="javalang.doc.anc44.gif">if the argument is negative; otherwise, it equals the argument.<p>
<a name="7242"></a>
If the unsigned 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 unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:<p>
<pre><a name="7213"></a><code>0123456789abcdef

⌨️ 快捷键说明

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