Methods for the integer class in Java __integer

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 a value of the base 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 type int and String, as well as other constants and methods that are useful when dealing with int types.

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

start with the following version:

JDK1.0

See also:

Serializing a table

field summary

/td>

Static int

max_value
   ;         A constant that retains the maximum value of type int is a value of 231-1.

Static int

min_value
           constants that hold the minimum value of type int are the desirable value of-231.

Static int

SIZE
&nb sp;          represents the number of digits in the int value in binary complement form.

Static class<integer>

type< /strong>
           represents a Class instance of the base type int.

Construction Method Summary

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

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

Method Summary

static int

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

Byte

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

Int

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

Static Integer

Decode (String nm)
Decodes a String to Integer.

Double

Doublevalue ()
Returns the value of the Integer with the double type.

Boolean

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

Float

Floatvalue ()
Returns the value of the Integer, in 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 1-bit of the highest (leftmost) value in the specified int value, with a maximum of 1 bits of int.

Int

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

Long

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

static int

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

static int

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

static int

Numberoftrailingzeros (int i)
Returns the number of 0 digits after the lowest ("right") 1 digit in the binary complement representation of the specified int value.

static int

parseint (String s)
Parse the string argument as a signed decimal integer.

static int

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

static int

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

static int

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

static int

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.