Integer.GetInteger Method

Definition

Overloads

GetInteger(String)

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, Int32)

Determines 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.

[Android.Runtime.Register("getInteger", "(Ljava/lang/String;)Ljava/lang/Integer;", "")]
public static Java.Lang.Integer? GetInteger (string nm);
[<Android.Runtime.Register("getInteger", "(Ljava/lang/String;)Ljava/lang/Integer;", "")>]
static member GetInteger : string -> Java.Lang.Integer

Parameters

nm
String

property name.

Returns

the Integer value of the property.

Attributes

Remarks

Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value using the grammar supported by Integer#decode decode and an Integer object representing this value is returned.

If there is no property with the specified name, if the specified name is empty or null, or if the property does not have the correct numeric format, then null is returned.

In other words, this method returns an Integer object equal to the value of:

<blockquote> getInteger(nm, null)</blockquote>

Java documentation for java.lang.Integer.getInteger(java.lang.String).

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.

Applies to

GetInteger(String, Integer)

Returns the integer value of the system property with the specified name.

[Android.Runtime.Register("getInteger", "(Ljava/lang/String;Ljava/lang/Integer;)Ljava/lang/Integer;", "")]
public static Java.Lang.Integer? GetInteger (string nm, Java.Lang.Integer? val);
[<Android.Runtime.Register("getInteger", "(Ljava/lang/String;Ljava/lang/Integer;)Ljava/lang/Integer;", "")>]
static member GetInteger : string * Java.Lang.Integer -> Java.Lang.Integer

Parameters

nm
String

property name.

val
Integer

default value.

Returns

the Integer value of the property.

Attributes

Remarks

Returns the integer value of the system property with the specified name. The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value, as per the Integer#decode decode method, and an Integer object representing this value is returned; in summary:

<ul><li>If the property value begins with the two ASCII characters 0x or the ASCII character #, not followed by a minus sign, then the rest of it is parsed as a hexadecimal integer exactly as by the method #valueOf(java.lang.String, int) with radix 16. <li>If the property value begins with the ASCII character 0 followed by another character, it is parsed as an octal integer exactly as by the method #valueOf(java.lang.String, int) with radix 8. <li>Otherwise, the property value is parsed as a decimal integer exactly as by the method #valueOf(java.lang.String, int) with radix 10. </ul>

The second argument is the default value. The default value is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null.

Java documentation for java.lang.Integer.getInteger(java.lang.String, 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.

Applies to

GetInteger(String, Int32)

Determines the integer value of the system property with the specified name.

[Android.Runtime.Register("getInteger", "(Ljava/lang/String;I)Ljava/lang/Integer;", "")]
public static Java.Lang.Integer? GetInteger (string nm, int val);
[<Android.Runtime.Register("getInteger", "(Ljava/lang/String;I)Ljava/lang/Integer;", "")>]
static member GetInteger : string * int -> Java.Lang.Integer

Parameters

nm
String

property name.

val
Int32

default value.

Returns

the Integer value of the property.

Attributes

Remarks

Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value using the grammar supported by Integer#decode decode and an Integer object representing this value is returned.

The second argument is the default value. An Integer object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null.

In other words, this method returns an Integer object equal to the value of:

<blockquote> getInteger(nm, new Integer(val))</blockquote>

but in practice it may be implemented in a manner such as:

<blockquote>

Integer result = getInteger(nm, null);
            return (result == null) ? new Integer(val) : result;

</blockquote>

to avoid the unnecessary allocation of an Integer object when the default value is not needed.

Java documentation for java.lang.Integer.getInteger(java.lang.String, int).

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.

Applies to