分享
 
 
 

java.lang.Long翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

java.lang

Class Longjava.lang.Object

java.lang.Number

java.lang.Long

All Implemented Interfaces: Comparable, Serializable public final class Long extends Number implements ComparableThe Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long. Long类以对象的形式对简单类型long进行包装,一个Long类型的对象包含一个类型为long的域。

In addition, this class provides several methods for converting a long to a String and a String to a long, as well as other constants and methods useful when dealing with a long. 而且,该类提供了很多将long转化成String或者String转化成long的方法,在处理long时其他的一些常量和方法同样有用。

Since: JDK1.0 See Also: Serialized FormField Summary

static long

MAX_VALUE

A constant holding the maximum value a long can have, 263-1. 常量,表示long类型的最大值263-1。

static long

MIN_VALUE

A constant holding the minimum value a long can have, -263. 常量,表示long类型的最小值-263。

static Class

TYPE

The Class instance representing the primitive type long. 表示简单类型long的Class实例。

Constructor Summary

Long(long value)

Constructs a newly allocated Long object that represents the specified long argument. 创建一个Long对象,表示指定的long值。

Long(String s)

Constructs a newly allocated Long object that represents the long value indicated by the String parameter. 创建一个Long对象,表示由String参数指定的long值。

Method Summary

byte

byteValue()

Returns the value of this Long as a byte. 以byte形式返回Long的值。

int

compareTo(Long anotherLong)

Compares two Long objects numerically. 在数值上比较两个Long对象。

int

compareTo(Object o)

Compares this Long object to another object. 将该Long对象与另一个对象比较。

static Long

decode(String nm)

Decodes a String into a Long. 将String解码成Long。

double

doubleValue()

Returns the value of this Long as a double. 以double形式返回Long的值。

boolean

equals(Object obj)

Compares this object to the specified object. 将该对象与指定对象比较。

float

floatValue()

Returns the value of this Long as a float. 以float形式返回Long的值。

static Long

getLong(String nm)

Determines the long value of the system property with the specified name. 确定指定名称的系统属性的long值。

static Long

getLong(String nm, long val)

Determines the long value of the system property with the specified name. 确定指定名称的系统属性的long值。

static Long

getLong(String nm, Long val)

Returns the long value of the system property with the specified name. 确定指定名称的系统属性的long值。

int

hashCode()

Returns a hash code for this Long. 返回该Long的hash码。

int

intValue()

Returns the value of this Long as an int. 以int形式返回Long的值。

long

longValue()

Returns the value of this Long as a long value. 以long形式返回Long的值。

static long

parseLong(String s)

Parses the string argument as a signed decimal long. 将字符串s转换成带符号十进制long。

static long

parseLong(String s, int radix)

Parses the string argument as a signed long in the radix specified by the second argument. 将字符串s转换成带符号long,进制由第二个参数指定。

short

shortValue()

Returns the value of this Long as a short. 以short形式返回Long的值。

static String

toBinaryString(long i)

Returns a string representation of the long argument as an unsigned integer in base 2. 将long参数转换为一个表示二进制无符号整数的字符串形式。

static String

toHexString(long i)

Returns a string representation of the long argument as an unsigned integer in base 16. 将long参数转换为一个表示十六进制无符号整数的字符串形式。

static String

toOctalString(long i)

Returns a string representation of the long argument as an unsigned integer in base 8. 将long参数转换为一个表示八进制无符号整数的字符串形式。

String

toString()

Returns a String object representing this Long's value. 返回表示Long值的String对象。

static String

toString(long i)

Returns a String object representing the specified long. 返回表示指定long值的String对象。

static String

toString(long i, int radix)

Returns a string representation of the first argument in the radix specified by the second argument. 返回第一个参数的字符串形式,进制由第二个参数指定。

static Long

valueOf(String s)

Returns a Long object holding the value of the specified String. 返回一个Long对象,等于指定String表示的值。

static Long

valueOf(String s, int radix)

Returns a Long object holding the value extracted from the specified String when parsed with the radix given by the second argument. 返回一个Long对象,等于指定String表示的值,转换的进制由第二个参数给定。

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

MIN_VALUEpublic static final long MIN_VALUE

A constant holding the minimum value a long can have, -263. 常量,表示long类型的最小值-263。

See Also: Constant Field ValuesMAX_VALUEpublic static final long MAX_VALUE

A constant holding the maximum value a long can have, 263-1. 常量,表示long类型的最大值263-1。

See Also: Constant Field ValuesTYPEpublic static final Class TYPE

The Class instance representing the primitive type long. 表示简单类型long的Class实例。

Since: JDK1.1 Constructor Detail

Longpublic Long(long value)

Constructs a newly allocated Long object that represents the specified long argument. 创建一个Long对象,表示指定的long值。

Parameters: value - the value to be represented by the Long object. Long对象表示的值。Longpublic Long(String s)

throws NumberFormatException

Constructs a newly allocated Long object that represents the long value indicated by the String parameter. The string is converted to a long value in exactly the manner used by the parseLong method for radix 10. 创建一个Long对象,表示由String参数指定的long值。 字符串转换成的long值恰好由parseLong方法(进制10)获取。

Parameters: s - the String to be converted to a Long. 要转换成Long的String。 Throws: NumberFormatException - if the String does not contain a parsable long. 如果String不能转换成long时抛出。 See Also: parseLong(java.lang.String, int)Method Detail

toStringpublic static String toString(long i,

int radix)

Returns a string representation of the first argument in the radix specified by the second argument. 返回第一个参数的字符串形式,进制由第二个参数指定。 If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the radix 10 is used instead. 如果进制小于Character.MIN_RADIX,或者大于Character.MAX_RADIX,那么使用进制10代替。

If the first argument is negative, the first element of the result is the ASCII minus sign '-' ('\u002d'). If the first argument is not negative, no sign character appears in the result. 如果第一个参数为负,结果的第一个元素为ASCII减号‘-’(‘\u002D’), 如果第一个参数不为负,结果中不会出现符号字符。

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 '0' ('\u0030'); otherwise, the first character of the representation of the magnitude will not be the zero character. The following ASCII characters are used as digits: 结果的剩余部分表示第一个参数的大小。如果大小为0,表示为单一的0字符‘0’(‘\u0030’), 否则表示大小的第一个字符不会是0字符。以下的ASCII字符作为数字使用:

0123456789abcdefghijklmnopqrstuvwxyz

These are '\u0030' through '\u0039' and '\u0061' through '\u007a'. If radix is N, then the first N of these characters are used as radix-N digits in the order shown. Thus, the digits for hexadecimal (radix 16) are 0123456789abcdef. If uppercase letters are desired, the String.toUpperCase() method may be called on the result: 字符有‘\u0030’到‘\u0039’和‘\u0061’到‘\u007A’。假设radix为N,那么 按顺序显示的字符中第一个N被用作进制-N位。因此,十六进制的位为0123456789abcdef。 如果希望得到大写字母,可以在结果上调用String.toUpperCase()方法。 Long.toString(n, 16).toUpperCase()

Parameters: i - a longto be converted to a string. 要转换成字符串的long。 radix - the radix to use in the string representation. 字符串表示中使用的进制。 Returns: a string representation of the argument in the specified radix. 指定进制的参数的字符串形式。 See Also: Character.MAX_RADIX, Character.MIN_RADIXtoHexStringpublic static String toHexString(long i)

Returns a string representation of the long argument as an unsigned integer in base 16. 将long参数转换为一个表示十六进制无符号整数的字符串形式。 The unsigned long value is the argument plus 264 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading 0s. If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); 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: 如果参数为负,无符号的long值为参数+264,否则等于参数。 该值按十六进制(不含0开头) 转换成ASCII位的字符串。如果无符号大小为0,可以用字符‘0’表示(‘\u0030’),否则 无符号大小的第一个字符不应该是0字符。以下字符被用作十六进制位:

0123456789abcdef

These are the characters '\u0030' through '\u0039' and '\u0061' through '\u0066'. If uppercase letters are desired, the String.toUpperCase() method may be called on the result: 字符有‘\u0030’到‘\u0039’和‘\u0061’到‘\u0066’。 如果希望得到大写字母,可以在结果上调用String.toUpperCase()方法。 Long.toHexString(n).toUpperCase()

Parameters: i - a long to be converted to a string. 要转换成字符串的long。 Returns: the string representation of the unsigned long value represented by the argument in hexadecimal (base 16). 参数(十六进制)表示的无符号long值的字符串形式。 Since: JDK 1.0.2 toOctalStringpublic static String toOctalString(long i)

Returns a string representation of the long argument as an unsigned integer in base 8. 将long参数转换为一个表示八进制无符号整数的字符串形式。 The unsigned long value is the argument plus 264 if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s. 如果参数为负,无符号的long值为参数+232,否则等于参数。 该值按八进制(不含0开头)转换成ASCII位的字符串。

If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as octal digits: 如果无符号大小为0,可以用字符‘0’表示(‘\u0030’),否则 无符号大小的第一个字符不应该是0字符。以下字符被用作八进制位:

01234567

These are the characters '\u0030' through '\u0037'. 字符有‘\u0030’到‘\u0037’。

Parameters: i - a long to be converted to a string. 要转换成字符串的long。 Returns: the string representation of the unsigned long value represented by the argument in octal (base 8). 参数(八进制)表示的无符号long值的字符串形式。 Since: JDK 1.0.2 toBinaryStringpublic static String toBinaryString(long i)

Returns a string representation of the long argument as an unsigned integer in base 2. 将long参数转换为一个表示二进制无符号整数的字符串形式。 The unsigned long value is the argument plus 264 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 2) with no extra leading 0s. If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits. 如果参数为负,无符号的long值为参数+232,否则等于参数。 该值按二进制(不含0开头) 转换成ASCII位的字符串。如果无符号大小 为0,可以用字符‘0’表示(‘\u0030’),否则 无符号大小的第一个字符 不应该是0字符。字符‘0’(‘\u0030’)和‘1’(‘\u0031’)被用作二进制位:

Parameters: i - a long to be converted to a string. 要转换成字符串的long。 Returns: the string representation of the unsigned long value represented by the argument in binary (base 2). 参数(二进制)表示的无符号long值的字符串形式。 Since: JDK 1.0.2 toStringpublic static String toString(long i)

Returns a String object representing the specified long. The argument is converted to signed decimal representation and returned as a string, exactly as if the argument and the radix 10 were given as arguments to the toString(long, int) method. 返回表示指定long值的String对象。参数被转换成带符号十进制形式,返回字符串,相当于toString(long, int)方法中指定进制10。

Parameters: i - a long to be converted. 要转换的long。 Returns: a string representation of the argument in base 10. 参数(十进制)的字符串形式。parseLongpublic static long parseLong(String s,

int radix)

throws NumberFormatException

Parses the string argument as a signed long 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 Character.digit(char, int) returns a nonnegative value), except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting long value is returned. 将字符串s转换成带符号long,进制由第二个参数指定。 字符串必须都是指定进制的数字 (根据Character.digit(char, int)中定义),除了第一个字符可能是ASCII‘-’(‘\u002D’)来表示负数。 返回long值结果。 Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator, as would be permitted in Java programming language source code - except that either L or l may appear as a digit for a radix greater than 22. 注意字符‘L’('\u004C')和‘l’('\u006C')不允许作为类型指示符在字符串末尾出现, 在Java语言源代码中允许,除非在大于22的进制中以位出现。

An exception of type NumberFormatException is thrown if any of the following situations occurs: 以下任一种情形发生,抛出NumberFormatException类型的异常:

The first argument is null or is a string of length zero. 第一个参数为null,或者字符串长度为0。 The radix is either smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX. 进制小于Character.MIN_RADIX或着大于Character.MAX_RADIX。 Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign '-' ('\u002d') provided that the string is longer than length 1. 字符串有任一字符不是指定进制的位,除第一个字符可以是‘-’(‘\u002D’)(字符串长度大于1)。 The value represented by the string is not a value of type long. 字符串表示的值不是long类型的值。 Examples:

parseLong("0", 10) returns 0L

parseLong("473", 10) returns 473L

parseLong("-0", 10) returns 0L

parseLong("-FF", 16) returns -255L

parseLong("1100110", 2) returns 102L

parseLong("99", 8) throws a NumberFormatException

parseLong("Hazelnut", 10) throws a NumberFormatException

parseLong("Hazelnut", 36) returns 1356099454469L

Parameters: s - the String containing the long representation to be parsed. 要转换成long形式的String radix - the radix to be used while parsing s. 转换s所用的进制。 Returns: the long represented by the string argument in the specified radix. 字符串参数按指定进制表示的long。 Throws: NumberFormatException - if the string does not contain a parsable long. 如果String不能转换成long时抛出。parseLongpublic static long parseLong(String s)

throws NumberFormatException

Parses the string argument as a signed decimal long. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' (\u002D') to indicate a negative value. The resulting long value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseLong(java.lang.String, int) method. 将字符串s转换成带符号十进制long。字符串必须都是十进制数字,除了第一个字符可能是ASCII‘-’(‘\u002D’)来表示负数。 返回long值结果,相当于在parseLong(java.lang.String, int)方法中指定进制10。 Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator, as would be permitted in Java programming language source code. 注意字符‘L’('\u004C')和‘l’('\u006C')不允许作为类型指示符在字符串末尾出现, 在Java语言源代码中允许。

Parameters: s - a String containing the long representation to be parsed 要转换成long形式的String Returns: the long represented by the argument in decimal. 参数按十进制表示的long值。 Throws: NumberFormatException - if the string does not contain a parsable long. 如果String不能转换成long时抛出。valueOfpublic static Long valueOf(String s,

int radix)

throws NumberFormatException

Returns a Long object holding the value extracted from the specified String when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed long in the radix specified by the second argument, exactly as if the arguments were given to the parseLong(java.lang.String, int) method. The result is a Long object that represents the long value specified by the string. 返回一个Long对象,等于指定String表示的值,转换的进制由第二个参数给定。 第一个参数被作为带符号的long,进制由第二个参数指定,相当于parseLong(java.lang.String, int)方法。 结果是Long对象,表示字符串指定的long值。 In other words, this method returns a Long object equal to the value of: 换言之,该方法返回Long对象,值等于:

new Long(Long.parseLong(s, radix))

Parameters: s - the string to be parsed 要转换的字符串。 radix - the radix to be used in interpreting s 被用来解释s的进制 Returns: a Long object holding the value represented by the string argument in the specified radix. 一个Long对象,等于字符串参数按指定进制表示的值。 Throws: NumberFormatException - If the String does not contain a parsable long. 如果String不能转换成long时抛出。valueOfpublic static Long valueOf(String s)

throws NumberFormatException

Returns a Long object holding the value of the specified String. The argument is interpreted as representing a signed decimal long, exactly as if the argument were given to the parseLong(java.lang.String) method. The result is a Long object that represents the integer value specified by the string. 返回一个Long对象,等于指定String表示的值。参数作为一个带符号十进制long,相当于parseLong(java.lang.String)方法。 结果返回一个Long对象,所表示的long值由字符串指定。 In other words, this method returns a Long object equal to the value of: 换言之,该方法返回Long对象,值等于:

new Long(Long.parseLong(s))

Parameters: s - the string to be parsed. 要转换的字符串。 Returns: a Long object holding the value represented by the string argument. 一个Long对象,等于字符串参数表示的值。 Throws: NumberFormatException - If the string cannot be parsed as a long. 如果String不能转换成long时抛出。decodepublic static Long decode(String nm)

throws NumberFormatException

Decodes a String into a Long. Accepts decimal, hexadecimal, and octal numbers given by the following grammar: 将String解码成Long。接受按以下语法给出的十进制、十六进制和八进制数: DecodableString: Signopt DecimalNumeral Signopt 0x HexDigits Signopt 0X HexDigits Signopt # HexDigits Signopt 0 OctalDigits

Sign: - DecimalNumeral, HexDigits, and OctalDigits are defined in §3.10.1 of the Java Language Specification. 十进制、十六进制和八进制在Java语言规范3.10.1中定义。 The sequence of characters following an (optional) negative sign and/or radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the Long.parseLong method with the indicated radix (10, 16, or 8). This sequence of characters must represent a positive value or a NumberFormatException will be thrown. The result is negated if first character of the specified String is the minus sign. No whitespace characters are permitted in the String. 字符序列以负号(可选)加进制标识符开头(0x、0X、#或0),使用指定进制(10、16或8)的 Long.parseLong转换。字符序列必须表示成正值,如果第一个指定String的第一个字符是‘-’号, 则抛出NumberFormatException。String中不允许有空白字符。

Parameters: nm - the String to decode. 要解码的String。 Returns: a Long object holding the long value represented by nm 由nm表示long值的Long对象 Throws: NumberFormatException - if the String does not contain a parsable long. 如果String不能转换成long时抛出。 Since: 1.2 See Also: parseLong(String, int)byteValuepublic byte byteValue()

Returns the value of this Long as a byte. 以byte形式返回Long的值。

Overrides: byteValue in class NumberReturns: the numeric value represented by this object after conversion to type byte. 该对象转换成byte类型后表示的数值。shortValuepublic short shortValue()

Returns the value of this Long as a short. 以short形式返回Long的值。

Overrides: shortValue in class NumberReturns: the numeric value represented by this object after conversion to type short. 该对象转换成short类型后表示的数值。intValuepublic int intValue()

Returns the value of this Long as an int. 以int形式返回Long的值。

Specified by: intValue in class NumberReturns: the numeric value represented by this object after conversion to type int. 该对象转换成int类型后表示的数值。longValuepublic long longValue()

Returns the value of this Long as a long value. 以long形式返回Long的值。

Specified by: longValue in class NumberReturns: the numeric value represented by this object after conversion to type long. 该对象转换成long类型后表示的数值。floatValuepublic float floatValue()

Returns the value of this Long as a float. 以float形式返回Long的值。

Specified by: floatValue in class NumberReturns: the numeric value represented by this object after conversion to type float. 该对象转换成float类型后表示的数值。doubleValuepublic double doubleValue()

Returns the value of this Long as a double. 以double形式返回Long的值。

Specified by: doubleValue in class NumberReturns: the numeric value represented by this object after conversion to type double. 该对象转换成double类型后表示的数值。toStringpublic String toString()

Returns a String object representing this Long's value. The value is converted to signed decimal representation and returned as a string, exactly as if the long value were given as an argument to the toString(long) method. 返回表示Long值的String对象。该值被转换成带符号十进制形式,以字符串返回,相当于toString(int)方法中以long值作为参数。

Overrides: toString in class ObjectReturns: a string representation of the value of this object in base 10. 该对象(十进制)值的字符串形式。hashCodepublic int hashCode()

Returns a hash code for this Long. The result is the exclusive OR of the two halves of the primitive long value held by this Long object. That is, the hashcode is the value of the expression: 返回该Long的hash码。结果是Long对象的简单long值的对分的OR运算,hash码值按如下表达式: (int)(this.longValue()^(this.longValue()>>>32))

Overrides: hashCode in class ObjectReturns: a hash code value for this object. 该对象的hash码值。 See Also: Object.equals(java.lang.Object), Hashtableequalspublic boolean equals(Object obj)

Compares this object to the specified object. The result is true if and only if the argument is not null and is a Long object that contains the same long value as this object. 将该对象与指定对象比较。只有当参数不为null,是Long对象,同该对象表示相同的long值,结果才为true。

Overrides: equals in class ObjectParameters: obj - the object to compare with. 要比较的对象。 Returns: true if the objects are the same; false otherwise. 如果对象相同,返回true,否则为false。 See Also: Object.hashCode(), HashtablegetLongpublic static Long getLong(String nm)

Determines the long value of the system property with the specified name. 确定指定名称的系统属性的long值。 The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. 第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值表示为long值,返回表示该值的Long对象。可能的数字格式详细信息可以从 getProperty定义中查找。

If there is no property with the specified name, if the specified name is empty or null, or if the property does not have the correct numeric format, then null is returned. 如果没有指定名称的属性,没有正确的数字格式,或者指定名称为空或null,返回默认值。

In other words, this method returns a Long object equal to the value of: 换言之,该方法返回Long对象,值等于:

getLong(nm, null)

Parameters: nm - property name. 属性名。 Returns: the Long value of the property. 属性的Long值。 See Also: System.getProperty(java.lang.String), System.getProperty(java.lang.String, java.lang.String)getLongpublic static Long getLong(String nm,

long val)

Determines the long value of the system property with the specified name. 确定指定名称的系统属性的long值。 The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. 第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值表示为long值,返回表示该值的Long对象。可能的数字格式详细信息可以从 getProperty定义中查找。

The second argument is the default value. A Long object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null. 第二个参数是默认值,如果没有指定名称的属性,没有正确的数字格式,或者指定名称为空或null,返回默认值。

In other words, this method returns a Long object equal to the value of: 换句话说,该方法返回Long对象,值等于:

getLong(nm, new Long(val)) but in practice it may be implemented in a manner such as: 实际上它可能由以下方式实现: Long result = getLong(nm, null);

return (result == null) ? new Long(val) : result;

to avoid the unnecessary allocation of a Long object when the default value is not needed. 当不需要默认值时以避免Long对象的不必要分配。

Parameters: nm - property name. 属性名。 val - default value. 默认值。 Returns: the Long value of the property. 属性的Long值。 See Also: System.getProperty(java.lang.String), System.getProperty(java.lang.String, java.lang.String)getLongpublic static Long getLong(String nm,

Long val)

Returns the long value of the system property with the specified name. The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value, as per the Long.decode method, and a Long object representing this value is returned. 确定指定名称的系统属性的long值。第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值被解释成long值,经过Long.decode处理后,返回表示该值的Long对象。

If the property value begins with the two ASCII characters 0x or the ASCII character #, not followed by a minus sign, then the rest of it is parsed as a hexadecimal integer exactly as for the method valueOf(java.lang.String, int) with radix 16. 如果属性值以ASCII字符0x或#开头,不跟-号,那么剩余部分由valueOf(java.lang.String, int)方法转换成十六进制整数。 If the property value begins with the ASCII character 0 followed by another character, it is parsed as an octal integer exactly as by the method valueOf(java.lang.String, int) with radix 8. 如果属性值以ASCII字符0开头,后跟另一字符,那么由valueOf(java.lang.String, int)方法转换成八进制整数。 Otherwise the property value is parsed as a decimal integer exactly as by the method valueOf(java.lang.String, int) with radix 10. 否则属性值由valueOf(java.lang.String, int)方法转换成十进制整数。 Note that, in every case, neither L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the property value as a type indicator, as would be permitted in Java programming language source code. 注意任何情况下,字符‘L’('\u004C')和‘l’('\u006C')不允许作为类型指示符在属性值末尾出现, 在Java语言源代码中允许。

The second argument is the default value. The default value is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null. 第二个参数是默认值,如果没有指定名称的属性,没有正确的数字格式,或者指定名称为空或null,返回默认值。

Parameters: nm - property name. 属性名。 val - default value. 默认值。 Returns: the Long value of the property. 属性的Long值。 See Also: System.getProperty(java.lang.String), System.getProperty(java.lang.String, java.lang.String), decode(java.lang.String)compareTopublic int compareTo(Long anotherLong)

Compares two Long objects numerically. 在数值上比较两个Long对象。

Parameters: anotherLong - the Long to be compared. 要比较的Long。 Returns: the value 0 if this Long is equal to the argument Long; a value less than 0 if this Long is numerically less than the argument Long; and a value greater than 0 if this Long is numerically greater than the argument Long (signed comparison). 如果该Long和等于Long参数,返回0;数值上小于Long参数,返回小于0的值; 数值上大于Long参数,返回大于0的值(带符号比较)。 Since: 1.2 compareTopublic int compareTo(Object o)

Compares this Long object to another object. If the object is a Long, this function behaves like compareTo(Long). Otherwise, it throws a ClassCastException (as Long objects are comparable only to other Long objects). 将该Long对象与另一个对象比较。如果该对象是Long,那么该函数和compareTo(Long)类似。否则,抛出 ClassCastException(因为只有Long对象才能和另一个Long对象比较)。

Specified by: compareTo in interface ComparableParameters: o - the Object to be compared. 要比较的对象。 Returns: the value 0 if the argument is a Long numerically equal to this Long; a value less than 0 if the argument is a Long numerically greater than this Long; and a value greater than 0 if the argument is a Long numerically less than this Long. 如果该参数是Long,数值上等于该Long,返回0;数值上大于该Long,返回小于0的值; 数值上小于该Long,返回大于0的值。 Throws: ClassCastException - if the argument is not a Long. 如果该参数不是Long时抛出。 Since: 1.2 See Also: Comparable[/url][url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有