Integer

extern class java.lang.Integerextends Numberimplements Comparable<Null<Int>>Available in java function new( param1 : Int ) : Void function compareTo( param1 : Null<Int> ) : IntCompares two {@code Integer} objects numerically.
@param anotherInteger the {@code Integer} to be compared. @return the value {@code 0} if this {@code Integer} is equal to the argument {@code Integer}; a value less than {@code 0} if this {@code Integer} is numerically less than the argument {@code Integer}; and a value greater than {@code 0} if this {@code Integer} is numerically greater than the argument {@code Integer} (signed comparison). @since 1.2
function equals( param1 : Dynamic ) : BoolCompares this object to the specified object. The result is {@code true} if and only if the argument is not {@code null} and is an {@code Integer} object that contains the same {@code int} value as this object.
param   obj   the object to compare with. return {@code true} if the objects are the same; {@code false} otherwise.
function hashCode() : IntReturns a hash code for this {@code Integer}.
@return a hash code value for this object, equal to the primitive {@code int} value represented by this {@code Integer} object.
function toString() : StringReturns a {@code String} object representing this {@code 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 {@link java.lang.Integer#toString(int)} method.
@return a string representation of the value of this object in base&nbsp;10.
static var MAX_VALUE(default,null) : Int static var MIN_VALUE(default,null) : Int static var SIZE(default,null) : IntThe number of bits used to represent an {@code int} value in two's complement binary form.
@since 1.5
static var TYPE : Class<Null<Int>>The {@code Class} instance representing the primitive type {@code int}.
@since JDK1.1
static function _toString( param1 : Int, param2 : Int ) : StringReturns a string representation of the first argument in the radix specified by the second argument.
<p>If the radix is smaller than {@code Character.MIN_RADIX} or larger than {@code Character.MAX_RADIX}, then the radix {@code 10} is used instead.
<p>If the first argument is negative, the first element of the result is the ASCII minus character {@code '-'} (
'&#92;u002D'
). If the first argument is not negative, no sign character appears in the result.
<p>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 {@code '0'} (
'&#92;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:
<blockquote> {@code 0123456789abcdefghijklmnopqrstuvwxyz} </blockquote>
These are
'&#92;u0030'
through
'&#92;u0039'
and
'&#92;u0061'
through
'&#92;u007A'
. If {@code radix} is <var>N</var>, then the first <var>N</var> of these characters are used as radix-<var>N</var> digits in the order shown. Thus, the digits for hexadecimal (radix 16) are {@code 0123456789abcdef}. If uppercase letters are desired, the {@link java.lang.String#toUpperCase()} method may be called on the result:
<blockquote> {@code Integer.toString(n, 16).toUpperCase()} </blockquote>
param   i       an integer to be converted to a string. param radix the radix to use in the string representation. return  a string representation of the argument in the specified radix. see java.lang.Character#MAX_RADIX @see java.lang.Character#MIN_RADIX
static function bitCount( param1 : Int ) : IntReturns the number of one-bits in the two's complement binary representation of the specified {@code int} value. This function is sometimes referred to as the <i>population count</i>.
@return the number of one-bits in the two's complement binary representation of the specified {@code int} value. @since 1.5
static function compare( param1 : Int, param2 : Int ) : IntCompares two {@code int} values numerically. The value returned is identical to what would be returned by: <pre> Integer.valueOf(x).compareTo(Integer.valueOf(y)) </pre>
@param x the first {@code int} to compare @param y the second {@code int} to compare @return the value {@code 0} if {@code x == y}; a value less than {@code 0} if {@code x < y}; and a value greater than {@code 0} if {@code x > y} @since 1.7
static function decode( param1 : String ) : Null<Int>Decodes a {@code String} into an {@code Integer}. Accepts decimal, hexadecimal, and octal numbers given by the following grammar:
<blockquote> <dl> <dt><i>DecodableString:</i> <dd><i>Sign<sub>opt</sub> DecimalNumeral</i> <dd><i>Sign<sub>opt</sub></i> {@code 0x} <i>HexDigits</i> <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i> <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i> <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i> <p> <dt><i>Sign:</i> <dd>{@code -} <dd>{@code +} </dl> </blockquote>
<i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i> are as defined in section 3.10.1 of <cite>The Java&trade; Language Specification</cite>, except that underscores are not accepted between digits.
<p>The sequence of characters following an optional sign and/or radix specifier ("{@code 0x}", "{@code 0X}", "{@code #}", or leading zero) is parsed as by the {@code Integer.parseInt} method with the indicated radix (10, 16, or 8). This sequence of characters must represent a positive value or a {@link NumberFormatException} will be thrown. The result is negated if first character of the specified {@code String} is the minus sign. No whitespace characters are permitted in the {@code String}.
@param nm the {@code String} to decode. @return an {@code Integer} object holding the {@code int} value represented by {@code nm} @exception NumberFormatException if the {@code String} does not contain a parsable integer. @see java.lang.Integer#parseInt(java.lang.String, int)
static function getInteger( param1 : String ) : Null<Int>Determines the integer value of the system property with the specified name.
<p>The first argument is treated as the name of a system property. System properties are accessible through the {@link java.lang.System#getProperty(java.lang.String)} method. The string value of this property is then interpreted as an integer value and an {@code Integer} object representing this value is returned. Details of possible numeric formats can be found with the definition of {@code getProperty}.
<p>If there is no property with the specified name, if the specified name is empty or {@code null}, or if the property does not have the correct numeric format, then {@code null} is returned.
<p>In other words, this method returns an {@code Integer} object equal to the value of:
<blockquote> {@code getInteger(nm, null)} </blockquote>
param   nm   property name. return the {@code Integer} value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String, java.lang.String)
static function highestOneBit( param1 : Int ) : IntReturns an {@code int} value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified {@code int} value. Returns zero if the specified value has no one-bits in its two's complement binary representation, that is, if it is equal to zero.
@return an {@code int} value with a single one-bit, in the position of the highest-order one-bit in the specified value, or zero if the specified value is itself equal to zero. @since 1.5
static function lowestOneBit( param1 : Int ) : IntReturns an {@code int} value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit in the specified {@code int} value. Returns zero if the specified value has no one-bits in its two's complement binary representation, that is, if it is equal to zero.
@return an {@code int} value with a single one-bit, in the position of the lowest-order one-bit in the specified value, or zero if the specified value is itself equal to zero. @since 1.5
static function numberOfLeadingZeros( param1 : Int ) : IntReturns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified {@code int} value. Returns 32 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
<p>Note that this method is closely related to the logarithm base 2. For all positive {@code int} values x: <ul> <li>floor(log<sub>2</sub>(x)) = {@code 31 - numberOfLeadingZeros(x)} <li>ceil(log<sub>2</sub>(x)) = {@code 32 - numberOfLeadingZeros(x - 1)} </ul>
@return the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified {@code int} value, or 32 if the value is equal to zero. @since 1.5
static function numberOfTrailingZeros( param1 : Int ) : IntReturns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified {@code int} value. Returns 32 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
@return the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified {@code int} value, or 32 if the value is equal to zero. @since 1.5
static function parseInt( param1 : String, param2 : Int ) : Int static function reverse( param1 : Int ) : IntReturns the value obtained by reversing the order of the bits in the two's complement binary representation of the specified {@code int} value.
@return the value obtained by reversing order of the bits in the specified {@code int} value. @since 1.5
static function reverseBytes( param1 : Int ) : IntReturns the value obtained by reversing the order of the bytes in the two's complement representation of the specified {@code int} value.
@return the value obtained by reversing the bytes in the specified {@code int} value. @since 1.5
static function rotateLeft( param1 : Int, param2 : Int ) : IntReturns the value obtained by rotating the two's complement binary representation of the specified {@code int} value left by the specified number of bits. (Bits shifted out of the left hand, or high-order, side reenter on the right, or low-order.)
<p>Note that left rotation with a negative distance is equivalent to right rotation: {@code rotateLeft(val, -distance) == rotateRight(val, distance)}. Note also that rotation by any multiple of 32 is a no-op, so all but the last five bits of the rotation distance can be ignored, even if the distance is negative: {@code rotateLeft(val, distance) == rotateLeft(val, distance & 0x1F)}.
@return the value obtained by rotating the two's complement binary representation of the specified {@code int} value left by the specified number of bits. @since 1.5
static function rotateRight( param1 : Int, param2 : Int ) : IntReturns the value obtained by rotating the two's complement binary representation of the specified {@code int} value right by the specified number of bits. (Bits shifted out of the right hand, or low-order, side reenter on the left, or high-order.)
<p>Note that right rotation with a negative distance is equivalent to left rotation: {@code rotateRight(val, -distance) == rotateLeft(val, distance)}. Note also that rotation by any multiple of 32 is a no-op, so all but the last five bits of the rotation distance can be ignored, even if the distance is negative: {@code rotateRight(val, distance) == rotateRight(val, distance & 0x1F)}.
@return the value obtained by rotating the two's complement binary representation of the specified {@code int} value right by the specified number of bits. @since 1.5
static function signum( param1 : Int ) : IntReturns the signum function of the specified {@code int} value. (The return value is -1 if the specified value is negative; 0 if the specified value is zero; and 1 if the specified value is positive.)
@return the signum function of the specified {@code int} value. @since 1.5
static function toBinaryString( param1 : Int ) : StringReturns a string representation of the integer argument as an unsigned integer in base&nbsp;2.
<p>The unsigned integer value is the argument plus 2<sup>32</sup> 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&nbsp;2) with no extra leading {@code 0}s. If the unsigned magnitude is zero, it is represented by a single zero character {@code '0'} (
'&#92;u0030'
); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The characters {@code '0'} (
'&#92;u0030'
) and {@code '1'} (
'&#92;u0031'
) are used as binary digits.
param   i   an integer to be converted to a string. return the string representation of the unsigned integer value represented by the argument in binary (base&nbsp;2). @since JDK1.0.2
static function toHexString( param1 : Int ) : StringReturns a string representation of the integer argument as an unsigned integer in base&nbsp;16.
<p>The unsigned integer value is the argument plus 2<sup>32</sup> 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&nbsp;16) with no extra leading {@code 0}s. If the unsigned magnitude is zero, it is represented by a single zero character {@code '0'} (
'&#92;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:
<blockquote> {@code 0123456789abcdef} </blockquote>
These are the characters
'&#92;u0030'
through
'&#92;u0039'
and
'&#92;u0061'
through
'&#92;u0066'
. If uppercase letters are desired, the {@link java.lang.String#toUpperCase()} method may be called on the result:
<blockquote> {@code Integer.toHexString(n).toUpperCase()} </blockquote>
param   i   an integer to be converted to a string. return the string representation of the unsigned integer value represented by the argument in hexadecimal (base&nbsp;16). @since JDK1.0.2
static function toOctalString( param1 : Int ) : StringReturns a string representation of the integer argument as an unsigned integer in base&nbsp;8.
<p>The unsigned integer value is the argument plus 2<sup>32</sup> 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&nbsp;8) with no extra leading {@code 0}s.
<p>If the unsigned magnitude is zero, it is represented by a single zero character {@code '0'} (
'&#92;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:
<blockquote> {@code 01234567} </blockquote>
These are the characters
'&#92;u0030'
through
'&#92;u0037'
.
param   i   an integer to be converted to a string. return the string representation of the unsigned integer value represented by the argument in octal (base&nbsp;8). @since JDK1.0.2
static function valueOf( param1 : String, param2 : Int ) : Null<Int>Returns an {@code Integer} object holding the value extracted from the specified {@code 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 {@link #parseInt(java.lang.String, int)} method. The result is an {@code Integer} object that represents the integer value specified by the string.
<p>In other words, this method returns an {@code Integer} object equal to the value of:
<blockquote> {@code new Integer(Integer.parseInt(s, radix))} </blockquote>
param      s   the string to be parsed. param radix the radix to be used in interpreting {@code s} @return an {@code Integer} object holding the value represented by the string argument in the specified radix. @exception NumberFormatException if the {@code String} does not contain a parsable {@code int}.
version #18636, modified 2013-05-08 10:55:15 by api
0 comment