An explanation and purpose of the integer class in Java

Source: Internet
Author: User
Tags comparable

Java.lang
Class Integer

Java.lang.Object

Java.lang.Number

Java.lang.Integer

all implemented interfaces:

Serializable, comparable<integer>

Public final class Integer

Extends number

Implements Comparable<integer>

The Integer class wraps the value of a primitive type int in the object. An object of type Integer contains a field of type int.

In addition, the class provides several methods for converting between int and String types, as well as some other constants and methods that are useful when working with int types.

Implementation considerations: The implementation of the "bit twiddling" method (such as Highestonebit and Numberoftrailingzeros) is based on Henry S. Warren, Hacker's Delight, written by Jr. (Addison Wesley, 2002) in some of the relevant materials.

start from the following versions:

JDK1.0

See also:

Serialization table

Field Summary

static int

Max_value
The constant that holds the maximum value of type int is the desirable value of 231-1.

static int

Min_value
The constant that holds the minimum value of type int is the desirable value of-231.

static int

SIZE
Represents the number of digits of an int value in twos complement form.

Static class<integer>

TYPE
Represents a Class instance of the base type int.

Construction Method Summary

Integer (int value)
Constructs a newly assigned Integer object that represents the specified int value.

Integer (String s)
Constructs a newly assigned Integer object that represents the int value indicated by the String parameter.

Method Summary

static int

Bitcount (int i)
Returns the number of 1 bits in the binary complement representation of the specified int value.

Byte

Bytevalue ()
Returns the value of the Integer in byte type.

Int

CompareTo (Integer Anotherinteger)
Compares two Integer objects on a number.

Static Integer

Decode (String nm)
Decodes a String to an Integer.

Double

Doublevalue ()
Returns the value of this Integer as a double type.

Boolean

equals (Object obj)
Compares this object with the specified object.

Float

Floatvalue ()
Returns the value of this Integer as a float type.

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 the hash code for this Integer.

static int

Highestonebit (int i)
Returns the position of the highest (leftmost) 1 bits of an int value with a maximum of 1 bits in the specified int value.

Int

Intvalue ()
Returns the value of the Integer as the int type.

Long

Longvalue ()
Returns the value of this Integer as a long type.

static int

Lowestonebit (int i)
Returns the position of an int value with a maximum of 1 bits, the lowest bit in the specified int value (rightmost), and 1 bits.

static int

Numberofleadingzeros (int i)
Returns the number of 0 bits before specifying the 1 bits of the highest bit (leftmost) in the binary complement representation of an int value.

static int

Numberoftrailingzeros (int i)
Returns the number of 0 digits following the lowest ("right-most") digit in the binary complement representation of the specified int value, which is 1.

static int

parseint (String s)
The string argument is parsed as a signed decimal integer.

static int

parseint (String s, int radix)
Resolves a string argument to a signed integer using the cardinality specified by the second argument.

static int

Reverse (int i)
Returns the value obtained by reversing the order of the bits in the binary complement representation of the specified int value.

static int

reversebytes (int i)
Returns the value obtained by reversing the order of the bytes in the binary complement representation of the specified int value.

static int

Rotateleft (int i, int distance)
Returns the value obtained from the binary complement representation of the specified int value, based on the specified number of digits in the loop.

static int

Rotateright (int i, int distance)
Returns the value that is obtained from the binary complement representation of the specified int value, based on the specified number of bits looping right.

Short

Shortvalue ()
Returns the value of the Integer in the short type.

static int

Signum (int i)
Returns a symbolic function that specifies an int value.

Static String

tobinarystring (int i)
Returns a string representation of an integer parameter as a binary (radix 2) unsigned integer.

Static String

tohexstring (int i)
Returns a string representation of an integer parameter as an unsigned 16-based integer.

Static String

tooctalstring (int i)
Returns a string representation of an integer parameter as a eight-based (radix 8) unsigned integer.

String

toString ()
Returns a String object that represents the Integer value.

Static String

toString (int i)
Returns a String object that represents the specified integer.

Static String

toString (int i, int radix)
Returns the string representation of the first argument, using the cardinality specified by the second argument.

Static Integer

valueOf (int i)
Returns an Integer instance that represents the specified int value.

Static Integer

valueOf (String s)
Returns an Integer object that holds the value of the specified String.

Static Integer

valueOf (String s, int radix)
Returns an Integer object that retains the value extracted from the specified String when parsed with the cardinality provided by the second argument.

An explanation and purpose of the integer class in Java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.