Integer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Integer class wraps a value of the primitive type
int in an object.
[Android.Runtime.Register("java/lang/Integer", DoNotGenerateAcw=true)]
public sealed class Integer : Java.Lang.Number, IConvertible, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IComparable
[<Android.Runtime.Register("java/lang/Integer", DoNotGenerateAcw=true)>]
type Integer = class
inherit Number
interface IConvertible
interface IComparable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
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.
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.
<!-- Android-removed: paragraph on ValueBased
This is a value-based class; programmers should treat instances that are #equals(Object) equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail. -->
Implementation note: The implementations of the "bit twiddling" methods (such as #highestOneBit(int) highestOneBit and #numberOfTrailingZeros(int) numberOfTrailingZeros) are based on material from Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002).
Added in 1.0.
Java documentation for java.lang.Integer.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
| Name | Description |
|---|---|
| Integer(Int32) |
Constructs a newly allocated |
| Integer(String) |
Constructs a newly allocated |
Fields
| Name | Description |
|---|---|
| Bytes |
The number of bytes used to represent an |
| MaxValue |
A constant holding the maximum value an |
| MinValue |
A constant holding the minimum value an |
| Size |
The number of bits used to represent an |
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniPeerMembers |
Gets the JNI metadata used to invoke members of this Java peer. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Number) |
| ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Number) |
| Type |
The |
Methods
| Name | Description |
|---|---|
| BitCount(Int32) |
Returns the number of one-bits in the two's complement binary
representation of the specified |
| ByteValue() |
Returns the value of the specified number as a |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Compare(Int32, Int32) |
Compares two |
| CompareTo(Integer) |
Compares two |
| CompareUnsigned(Int32, Int32) |
Compares two |
| Compress(Int32, Int32) |
Returns the value obtained by compressing the bits of the
specified |
| Decode(String) |
Decodes a |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DivideUnsigned(Int32, Int32) |
Returns the unsigned quotient of dividing the first argument by the second where each argument and the result is interpreted as an unsigned value. |
| DoubleValue() |
Returns the value of this |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| Expand(Int32, Int32) |
Returns the value obtained by expanding the bits of the
specified |
| FloatValue() |
Returns the value of this |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetInteger(String, Int32) |
Determines the integer value of the system property with the specified name. |
| GetInteger(String, Integer) |
Returns the integer value of the system property with the specified name. |
| GetInteger(String) |
Determines the integer value of the system property with the specified name. |
| HashCode(Int32) |
Returns a hash code for an |
| HighestOneBit(Int32) |
Returns an |
| IntValue() |
Returns the value of this |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| LongValue() |
Returns the value of this |
| LowestOneBit(Int32) |
Returns an |
| Max(Int32, Int32) |
Returns the greater of two |
| Min(Int32, Int32) |
Returns the smaller of two |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| NumberOfLeadingZeros(Int32) |
Returns the number of zero bits preceding the highest-order
("leftmost") one-bit in the two's complement binary representation
of the specified |
| NumberOfTrailingZeros(Int32) |
Returns the number of zero bits following the lowest-order ("rightmost")
one-bit in the two's complement binary representation of the specified
|
| ParseInt(ICharSequence, Int32, Int32, Int32) |
Parses the |
| ParseInt(String, Int32, Int32, Int32) |
Parses the |
| ParseInt(String, Int32) |
Parses the string argument as a signed integer in the radix specified by the second argument. |
| ParseInt(String) |
Parses the string argument as a signed decimal integer. |
| ParseUnsignedInt(ICharSequence, Int32, Int32, Int32) |
Parses the |
| ParseUnsignedInt(String, Int32, Int32, Int32) |
Parses the |
| ParseUnsignedInt(String, Int32) |
Parses the string argument as an unsigned integer in the radix specified by the second argument. |
| ParseUnsignedInt(String) |
Parses the string argument as an unsigned decimal integer. |
| RemainderUnsigned(Int32, Int32) |
Returns the unsigned remainder from dividing the first argument by the second where each argument and the result is interpreted as an unsigned value. |
| Reverse(Int32) |
Returns the value obtained by reversing the order of the bits in the
two's complement binary representation of the specified |
| ReverseBytes(Int32) |
Returns the value obtained by reversing the order of the bytes in the
two's complement representation of the specified |
| RotateLeft(Int32, Int32) |
Returns the value obtained by rotating the two's complement binary
representation of the specified |
| RotateRight(Int32, Int32) |
Returns the value obtained by rotating the two's complement binary
representation of the specified |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| ShortValue() |
Returns the value of the specified number as a |
| Signum(Int32) |
Returns the signum function of the specified |
| Sum(Int32, Int32) |
Adds two integers together as per the + operator. |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToBinaryString(Int32) |
Returns a string representation of the integer argument as an unsigned integer in base 2. |
| ToHexString(Int32) |
Returns a string representation of the integer argument as an unsigned integer in base 16. |
| ToOctalString(Int32) |
Returns a string representation of the integer argument as an unsigned integer in base 8. |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| ToString(Int32, Int32) |
Returns a string representation of the first argument in the radix specified by the second argument. |
| ToString(Int32) |
Returns a |
| ToUnsignedLong(Int32) |
Converts the argument to a |
| ToUnsignedString(Int32, Int32) |
Returns a string representation of the first argument as an unsigned integer value in the radix specified by the second argument. |
| ToUnsignedString(Int32) |
Returns a string representation of the argument as an unsigned decimal value. |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| ValueOf(Int32) |
Returns an |
| ValueOf(String, Int32) |
Returns an |
| ValueOf(String) |
Returns an |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Operators
| Name | Description |
|---|---|
| Explicit(Integer to Int32) |
Converts the specified |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IComparable.CompareTo(Object) |
Compares this value with the specified object for ordering. |
| IConvertible.GetTypeCode() |
Returns the type code for this value. |
| IConvertible.ToBoolean(IFormatProvider) |
Converts this value to |
| IConvertible.ToByte(IFormatProvider) |
Converts this value to |
| IConvertible.ToChar(IFormatProvider) |
Converts this value to |
| IConvertible.ToDateTime(IFormatProvider) |
Conversion to |
| IConvertible.ToDecimal(IFormatProvider) |
Converts this value to |
| IConvertible.ToDouble(IFormatProvider) |
Converts this value to |
| IConvertible.ToInt16(IFormatProvider) |
Converts this value to |
| IConvertible.ToInt32(IFormatProvider) |
Converts this value to |
| IConvertible.ToInt64(IFormatProvider) |
Converts this value to |
| IConvertible.ToSByte(IFormatProvider) |
Converts this value to |
| IConvertible.ToSingle(IFormatProvider) |
Converts this value to |
| IConvertible.ToString(IFormatProvider) |
Converts this value to |
| IConvertible.ToType(Type, IFormatProvider) |
Converts this value to the type specified by |
| IConvertible.ToUInt16(IFormatProvider) |
Converts this value to |
| IConvertible.ToUInt32(IFormatProvider) |
Converts this value to |
| IConvertible.ToUInt64(IFormatProvider) |
Converts this value to |
| IJavaPeerable.Disposed() |
Notifies the interop runtime that this managed peer has been disposed. (Inherited from Object) |
| IJavaPeerable.DisposeUnlessReferenced() |
Releases this Java peer unless it is retained by another managed reference. (Inherited from Object) |
| IJavaPeerable.Finalized() |
Notifies the interop runtime that this managed peer has been finalized. (Inherited from Object) |
| IJavaPeerable.JniManagedPeerState |
Gets the state that describes the relationship between this managed peer and its JNI reference. (Inherited from Object) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
Sets the interop identity hash code for this Java peer. (Inherited from Object) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
Sets the managed and JNI peer state for this Java peer. (Inherited from Object) |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
Sets the JNI object reference used by this managed peer. (Inherited from Object) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |