Integer类

目录

所在包

所有已实现的接口

Field Summary字段汇总

Constructor Summary构造函数的总结

Method Summary方法总结

 

所在包:java.lang.Integer

 

所有已实现的接口:Serializable, Comparable<Integer

 

1 public final class Integer
2 extends Number
3 implements Comparable<Integer>
The 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 类型时非常有用的其他一些常量和方法。

 

Implementation note: The implementations of the "bit twiddling" methods (such as highestOneBit and numberOfTrailingZeros) are based on material from Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002).

实现注意事项:“bit twiddling”方法(如 highestOneBitnumberOfTrailingZeros)的实现基于 Henry S. Warren, Jr.撰写的 Hacker's Delight(Addison Wesley, 2002)中的一些有关材料。 

 

Since:
从以下版本开始:
JDK1.0
See Also:
另请参见:
Serialized Form
序列化表格

 Field Summary字段汇总

Fields 字段

Modifier and Type

修饰符和类型

Field and Description

字段和描述

static int BYTES
The number of bytes used to represent a int value in two's complement binary form.
用二进制补码形式表示 int 整数值的字节数。
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 int SIZE
The number of bits used to represent an int value in two's complement binary form.
用二进制补码形式表示int整数的位数。
static Class<Integer> TYPE
The Class instance representing the primitive type int.
表示基本类型int的类实例。

 

Constructor Summary构造函数的总结

 

Constructors 构造函数
Constructor and Description
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方法总结

Modifier and TypeMethod and Description
static int bitCount(int i)
Returns the number of one-bits in the two's complement binary representation of the specified int value.
返回指定 int 值的二进制补码表示形式中的一位数。
 
byte byteValue()
Returns the value of this Integer as a byte after a narrowing primitive conversion.
byte 类型返回该 Integer 的值。
static int compare(int x, int y)
Compares two int values numerically.
对两个int值进行数值比较。
int compareTo(Integer anotherInteger)
Compares two Integer objects numerically.
对两个整数对象进行数值比较。
static int compareUnsigned(int x, int y)
Compares two int values numerically treating the values as unsigned.
将两个 int 整型值作为无符号进行数值比较。
static Integer decode(String nm)
Decodes a String into an Integer.
将String字符串解码为int整数。
static int divideUnsigned(int dividend, int divisor)
Returns the unsigned quotient of dividing the first argument by the second where each argument and the result is interpreted as an unsigned value.
返回第一个参数除以第二个参数的无符号商,其中每个参数和结果都被解释为无符号值。
double doubleValue()
Returns the value of this Integer as a double after a widening primitive conversion.
经过扩展的原语转换后,以double双精度值的形式返回此Integer整数的值。
boolean equals(Object obj)
Compares this object to the specified object.
将此对象与指定的对象进行比较。
float floatValue()
Returns the value of this Integer as a float after a widening primitive conversion.
经过扩展的原语转换后,以float浮点数的形式返回此int整数的值。
static Integer getInteger(String nm)
Determines the integer value of the system property with the specified name.
确定具有指定名称的系统属性的integer整数值。
static Integer getInteger(String nm, int val)
Determines the integer value of the system property with the specified name.
确定具有指定名称的系统属性的integer整数值。
static Integer getInteger(String nm, Integer val)
Returns the integer value of the system property with the specified name.
返回指定名称的系统属性的integer整数值。
int hashCode()
Returns a hash code for this Integer.
返回该Integer整数的hash哈希码。
static int hashCode(int value)
Returns a hash code for a int value; compatible with Integer.hashCode().
返回一个int整型值的哈希码;兼容Integer.hashCode ()。
static int highestOneBit(int i)
Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified int value.
返回一个int值,该值最多为一位,位于指定的int值中顺序最高(“最左”)的一位。
int intValue()
Returns the value of this Integer as an int.
以int整数形式返回该整数的值。
long longValue()
Returns the value of this Integer as a long after a widening primitive conversion.
将此Integer整数的值作为扩展原语转换后的long。
static int lowestOneBit(int i)
Returns an int value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit in the specified int value.
在指定的int整型值中,以最低顺序(“最右边”)的一个位的位置返回一个最多一个位的int整型值。
static int max(int a, int b)
Returns the greater of two int values as if by calling Math.max.
通过调用Math.max返回两个int值中较大的那个。
static int min(int a, int b)
Returns the smaller of two int values as if by calling Math.min.
通过调用Math.min返回两个int值中较小的那个。
static int numberOfLeadingZeros(int i)
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified int value.
返回指定int整型值的补码二进制表示中最高位(“最左位”)前的零位数。
static int numberOfTrailingZeros(int i)
Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified int value.
返回指定int整型值的二进制补码表示中最低顺序(“最右”)的1位之后的零位数。
static int parseInt(String s)
Parses the string argument as a signed decimal integer.
将string字符串参数解析为带符号的十进制integer整数。
static int parseInt(String s, int radix)
Parses the string argument as a signed integer in the radix specified by the second argument.
将string字符串参数解析为signed integer带符号的整数,基数由第二个参数指定。
static int parseUnsignedInt(String s)
Parses the string argument as an unsigned decimal integer.
将string字符串参数解析为无符号的十进制整数。

static int

parseUnsignedInt(String s, int radix)
Parses the string argument as an unsigned integer in the radix specified by the second argument.
将string字符串参数解析为第二个参数指定的基数中的unsigned integer无符号整数。
static int remainderUnsigned(int dividend, int divisor)
Returns the unsigned remainder from dividing the first argument by the second where each argument and the result is interpreted as an unsigned value.
返回从第一个参数除以第二个参数得到的无符号余数,其中每个参数和结果都被解释为无符号值。
static int reverse(int i)
Returns the value obtained by reversing the order of the bits in the two's complement binary representation of the specified int value.
返回指定int整型值的二进制补码表示法中二进制位的逆序所得到的值。
static int reverseBytes(int i)
Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified int value.
返回指定int整数值的两个补码表示形式中字节的逆序得到的值。
static int rotateLeft(int i, int distance)
Returns the value obtained by rotating the two's complement binary representation of the specified int value left by the specified number of bits.
返回通过将指定的int值的指定补码二进制表示形式旋转到指定的位数所得到的值。
static int rotateRight(int i, int distance)
Returns the value obtained by rotating the two's complement binary representation of the specified int value right by the specified number of bits.
返回通过将指定int整数值的两个补码二进制表示形式右转指定位数所得到的值。
short shortValue()
Returns the value of this Integer as a short after a narrowing primitive conversion.
在收缩原始的转换后将此Integer整数的值作为short类型返回。
static int signum(int i)
Returns the signum function of the specified int value.
返回指定int值的signum 函数(正负号函数)。
static int sum(int a, int b)
Adds two integers together as per the + operator.
根据+运算符将两个integers整数相加。
static String toBinaryString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 2.
以2为基底,以无符号整数的形式返回整数参数的string字符串表示形式。
static String toHexString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 16.
以16为基底,以无符号整数的形式返回整数参数的string字符串表示形式。
static String toOctalString(int i)
Returns a string representation of the integer argument as an unsigned integer in base 8.
以8为基底,以无符号整数的形式返回整数参数的string字符串表示形式。
String toString()
Returns a String object representing this Integer's value.
返回一个表示该Integer`s整数值的String字符串对象。
static String toString(int i)
Returns a String object representing the specified integer.
返回一个表示指定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 long toUnsignedLong(int x)
Converts the argument to a long by an unsigned conversion.
通过无符号转换将参数转换为long类型。
static String toUnsignedString(int i)
Returns a string representation of the argument as an unsigned decimal value.
以无符号十进制值的形式返回参数的字符串表示形式。
static String toUnsignedString(int i, int radix)
Returns a string representation of the first argument as an unsigned integer value in the radix specified by the second argument.
以无符号整数值的形式返回第一个参数的字符串表示形式,基数由第二个参数指定。
static Integer valueOf(int i)
Returns an Integer instance representing the specified int value.
返回一个Integer整数实例,该实例表示指定的int整型值。
static Integer valueOf(String s)
Returns an Integer object holding the value of the specified String.
返回一个保存指定String字符串值的Integer整数对象。

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.
使用第二个参数提供的基数进行解析时,返回一个保存从指定String字符串中提取的值的Integer整数对象。

 


 析为无符号的十进制整数。

原文地址:https://www.cnblogs.com/LinQingYang/p/12467233.html