分享
 
 
 

java.lang.Integer翻译

王朝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 Integerjava.lang.Object

java.lang.Number

java.lang.Integer

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

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

Since: JDK1.0 See Also: Serialized FormField Summary

static int

MAX_VALUE

A constant holding the maximum value an int can have, 231-1. 常量,表示int类型的最大值231-1。

static int

MIN_VALUE

A constant holding the minimum value an int can have, -231. 常量,表示int类型的最小值-231。

static Class

TYPE

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

Constructor Summary

Integer(int value)

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

Integer(String s)

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

Method Summary

byte

byteValue()

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

int

compareTo(Integer anotherInteger)

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

int

compareTo(Object o)

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

static Integer

decode(String nm)

Decodes a String into an Integer. 将String解码成Integer。

double

doubleValue()

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

boolean

equals(Object obj)

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

float

floatValue()

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

static Integer

getInteger(String nm)

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

static Integer

getInteger(String nm, int val)

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

static Integer

getInteger(String nm, Integer val)

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

int

hashCode()

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

int

intValue()

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

long

longValue()

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

static int

parseInt(String s)

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

static int

parseInt(String s, int radix)

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

short

shortValue()

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

static String

toBinaryString(int i)

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

static String

toHexString(int i)

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

static String

toOctalString(int i)

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

String

toString()

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

static String

toString(int i)

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

static String

toString(int i, int radix)

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

static Integer

valueOf(String s)

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

static Integer

valueOf(String s, int radix)

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

Methods inherited from class java.lang.Object

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

Field Detail

MIN_VALUEpublic static final int MIN_VALUE

A constant holding the minimum value an int can have, -231. 常量,表示int类型的最小值-231。

See Also: Constant Field ValuesMAX_VALUEpublic static final int MAX_VALUE

A constant holding the maximum value an int can have, 231-1. 常量,表示int类型的最大值231-1。

See Also: Constant Field ValuesTYPEpublic static final Class TYPE

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

Since: JDK1.1 Constructor Detail

Integerpublic Integer(int value)

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

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

throws NumberFormatException

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

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

toStringpublic static String toString(int 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 character '-' ('\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()方法。 Integer.toString(n, 16).toUpperCase()

Parameters: i - an integer to be converted to a string. 要转换成字符串的整数。 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(int i)

Returns a string representation of the integer argument as an unsigned integer in base 16. 将整数参数转换为一个表示十六进制无符号整数的字符串形式。 The unsigned integer value is the argument plus 232 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: 如果参数为负,无符号的整数值为参数+232,否则等于参数。 该值按十六进制(不含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()方法。 Integer.toHexString(n).toUpperCase()

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

Returns a string representation of the integer argument as an unsigned integer in base 8. 将整数参数转换为一个表示八进制无符号整数的字符串形式。 The unsigned integer value is the argument plus 232 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. 如果参数为负,无符号的整数值为参数+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 - an integer to be converted to a string. 要转换成字符串的整数。 Returns: the string representation of the unsigned integer value represented by the argument in octal (base 8). 参数(八进制)表示的无符号整数值的字符串形式。 Since: JDK1.0.2 toBinaryStringpublic static String toBinaryString(int i)

Returns a string representation of the integer argument as an unsigned integer in base 2. 将整数参数转换为一个表示二进制无符号整数的字符串形式。 The unsigned integer value is the argument plus 232 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. 如果参数为负,无符号的整数值为参数+232,否则等于参数。 该值按二进制(不含0开头) 转换成ASCII位的字符串。如果无符号大小 为0,可以用字符‘0’表示(‘\u0030’),否则 无符号大小的第一个字符 不应该是0字符。字符‘0’(‘\u0030’)和‘1’(‘\u0031’)被用作二进制位:

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

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

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

int radix)

throws NumberFormatException

Parses the string argument as a signed integer 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 integer value is returned. 将字符串s转换成带符号整数,进制由第二个参数指定。 字符串必须都是指定进制的数字 (根据Character.digit(char, int)中定义),除了第一个字符可能是ASCII‘-’(‘\u002D’)来表示负数。 返回整数值结果。 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 int. 字符串表示的值不是int类型的值。 Examples:

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

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

throws NumberFormatException

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 '-' ('\u002D') 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 parseInt(java.lang.String, int) method. 将字符串s转换成带符号十进制整数。字符串必须都是十进制数字,除了第一个字符可能是ASCII‘-’(‘\u002D’)来表示负数。 返回整数值结果,相当于在parseInt(java.lang.String, int)方法中指定进制10。

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

int radix)

throws NumberFormatException

Returns an Integer 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 integer in the radix specified by the second argument, exactly as if the arguments were given to the parseInt(java.lang.String, int) method. The result is an Integer object that represents the integer value specified by the string. 返回一个Integer对象,等于指定String表示的值,转换的进制由第二个参数给定。 第一个参数被作为带符号的整数,进制由第二个参数指定,相当于parseInt(java.lang.String, int)方法。 结果是Integer对象,表示字符串指定的整数值。 In other words, this method returns an Integer object equal to the value of: 换言之,该方法返回Integer对象,值等于

new Integer(Integer.parseInt(s, radix))

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

throws NumberFormatException

Returns an Integer object holding 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 parseInt(java.lang.String) method. The result is an Integer object that represents the integer value specified by the string. 返回一个Integer对象,等于指定String表示的值。参数作为一个带符号十进制整数,相当于parseInt(java.lang.String)方法。 结果返回一个Integer对象,所表示的整数值由字符串指定。 In other words, this method returns an Integer object equal to the value of: 换言之,该方法返回Integer对象,值等于

new Integer(Integer.parseInt(s))

Parameters: s - the string to be parsed. 要转换的字符串。 Returns: an Integer object holding the value represented by the string argument. 一个Integer对象,等于字符串参数表示的值 Throws: NumberFormatException - if the string cannot be parsed as an integer. 如果String不能转换成整数时抛出。byteValuepublic byte byteValue()

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

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 Integer as a short. 以short形式返回Integer的值。

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 Integer as an int. 以int形式返回Integer的值。

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 Integer as a long. 以long形式返回Integer的值。

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 Integer as a float. 以float形式返回Integer的值。

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 Integer as a double. 以double形式返回Integer的值。

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 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 toString(int) method. 返回表示Integer值的String对象。该值被转换成带符号十进制形式,以字符串返回,相当于toString(int)方法中以整数值作为参数。

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 Integer. 返回该Integer的hash码。

Overrides: hashCode in class ObjectReturns: a hash code value for this object, equal to the primitive int value represented by this Integer object. 该对象的hash码值,等于该Integer对象表示的简单int值。 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 an Integer object that contains the same int value as this object. 将该对象与指定对象比较。只有当参数不为null,是Integer对象,同该对象表示相同的int值,结果才为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(), HashtablegetIntegerpublic static Integer getInteger(String nm)

Determines the integer 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 an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. 第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值表示为整数值,返回表示该值的Integer对象。可能的数字格式详细信息可以从 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 an Integer object equal to the value of: 换言之,该方法返回Integer对象,值等于

getInteger(nm, null)

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

int val)

Determines the integer 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 an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. 第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值表示为整数值,返回表示该值的Integer对象。可能的数字格式详细信息可以从 getProperty定义中查找。

The second argument is the default value. An Integer 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 an Integer object equal to the value of: 换句话说,该方法返回Integer对象,值等于

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

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

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

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

Integer val)

Returns the integer 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 an integer value, as per the Integer.decode method, and an Integer object representing this value is returned. 确定指定名称的系统属性的整数值。第一个参数作为系统属性的名称。系统属性可以通过System.getProperty(java.lang.String)方法 访问。属性的字符串值被解释成整数值,经过Integer.decode处理后,返回表示该值的Integer对象。

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 by 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)方法转换成十进制整数。 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 Integer value of the property. 属性的Integer值。 See Also: System.getProperty(java.lang.String), System.getProperty(java.lang.String, java.lang.String), decode(java.lang.String)decodepublic static Integer decode(String nm)

throws NumberFormatException

Decodes a String into an Integer. Accepts decimal, hexadecimal, and octal numbers numbers given by the following grammar: 将String解码成Integer。接受按以下语法给出的十进制、十六进制和八进制数 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 Integer.parseInt 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)的 Integer.parseInt转换。字符序列必须表示成正值,如果第一个指定String的第一个字符是‘-’号, 则抛出NumberFormatException。String中不允许有空白字符。

Parameters: nm - the String to decode. 要解码的String。 Returns: a Integer object holding the int value represented by nm 由nm表示int值的Integer对象 Throws: NumberFormatException - if the String does not contain a parsable integer. 如果String不能转换成整数时抛出。 Since: 1.2 See Also: parseInt(java.lang.String, int)compareTopublic int compareTo(Integer anotherInteger)

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

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

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

Specified by: compareTo in interface ComparableParameters: o - the Object to be compared. 要比较的对象。 Returns: the value 0 if the argument is a Integer numerically equal to this Integer; a value less than 0 if the argument is a Integer numerically greater than this Integer; and a value greater than 0 if the argument is a Integer numerically less than this Integer. 如果该参数是Integer,数值上等于该Integer,返回0;数值上大于该Integer,返回小于0的值; 数值上小于该Integer,返回大于0的值。 Throws: ClassCastException - if the argument is not an Integer. 如果该参数不是Integer时抛出。 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- 王朝網路 版權所有