Integer Methods
Use Primavera Cloud Expression Language supported integer methods to manipulate numeric data of the integer type.
Refer to the official Java documentation for more information on each method.
Notes:
- Primavera Cloud Expression Language automatically converts Doubles to Int types when calling methods that require Int arguments.
- Types are indicated in bold in each method signature.
Integer Methods
Method Signature | Description | Parameters | Example |
---|---|---|---|
| Returns an Integer value representing the contents of the String passed as an argument. | String string - String from which to extract an integer value. |
|
| Returns an Integer value representing the value of a String passed as an argument. | String string - String from which to extract an Integer value. Int radix - Specifies the radix to use when converting the String argument into an Integer, for example, 2, 8, 16. |
|
Additional Integer Methods
Method Signature | Description | Parameters | Examples |
---|---|---|---|
| Returns the number of one bits in the binary representation of the Int value passed as an argument. | Int value -Int value containing one bits to be counted. |
|
| Compares the value of the first Int passed as an argument to the value of the second Int passed as an argument. Returns 0 if the values are equal, returns less than 0 if the first argument is less than the second, and returns a value greater than 0 if the first argument is greater than the second. | Int x - The first Int value to compare. Int y - The second Int value to compare. | Integer.compare(3,3); //returns 0 Integer.compare(3, 4); //returns -1 Integer.compare(4,3); //returns 1 |
| Returns the result of converting the String passed as an argument into an Int value. The argument String must be in decimal, hexadecimal, or octal format. | String number - String to convert into an Int value. | Integer.decode("24"); //returns 24 |
| Returns a hash code representing the Integer calling this method. | No method parameters. | def x = 12; x.hashCode(); //returns 12 |
| Returns an Int value with at most a single one bit in the position of the leftmost one bit contained in the binary representation of the Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. | Integer.highestOneBit(12); //returns 8 |
| Returns an Int value with at most a single one bit in the position of the rightmost one bit contained in the binary representation of the Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. | Integer.lowestOneBit(12); //returns 4 |
| Returns the number of zeros preceding the leftmost one bit in the binary representation of the Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. | Integer.numberOfLeadingZeros(12); //returns 28 |
| Returns the number of zeros following the rightmost one bit in the binary representation of the Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. | Integer.numberOfTrailingZeros(12); //returns 2 |
Integer.reverse(Int value) | Returns the result of reversing the order of bits contained in the binary representation of the Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. | Integer.reverse(12); //returns 805306368 |
| Returns the result of rotating the binary representation of the Int value passed as an argument left by the value specified by the second Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. Int distance - Number of places to rotate the binary representation of the first argument left. | Integer.rotateLeft(12, 4); //returns 192 |
| Returns the result of rotating the binary representation of the Int value passed as an argument right by the value specified by the second Int value passed as an argument. | Int value - Integer value containing one bits in its binary representation. Int distance - Number of places to rotate the binary representation of the first argument right. | Integer.rotateRight(12, 4); //returns -1073741824 |
| Returns the signum function of the Int value passed as an argument. The signum value indicates whether an integer is positive, negative, or zero. | Int value - Int value against which to calculate signum. | Integer.signum(12); //returns 1 |
| Returns a string representation of the binary representation of the Int value passed as an argument. | Int value - Integer value to convert to a binary representation. | Integer.toBinaryString(12); //returns "1100" |
| Returns a string representation of the hexadecimal representation of the Int value passed as an argument. | Int value - Integer value to convert to a hexadecimal representation. | Integer.toHexString(12); //returns "c" |
| Returns a string representation of the octal representation of the Int value passed as an argument. | Int value - Integer value to convert to an octal representation. | Integer.toOctalString(); //returns 14 |
Last Published Tuesday, May 21, 2024