util.Integer.shiftLeft
Returns the INTEGER
value left-shifted by the given
bit places.
Syntax
util.Integer.shiftLeft(
i INTEGER,
n SMALLINT
)
RETURNS INTEGER
- i is the integer value to shift.
- n is the left-shift distance in bits.
Usage
The
util.Integer.shiftLeft()
method shifts the bits to the left in the integer
value passed in the first parameter by the number places specified by the second
parameter. i : 210 (00000000 11010010)
n : 3
--------------------------------
result :1680 (00000110 10010000)
Bits shifted out from the left end are lost.
Bits shifted in from the right end are set to 0.
Note: Bitwise methods provided by the
util.Integer
class are
based on the INTEGER
type. Consider the following facts when using these methods: - The
INTEGER
type is a four-byte signed integer: If the bit at position 31 is set to 1, the correspondingINTEGER
value will be negative. Thus,util.Integer.not(0)
produces theINTEGER
value-1
(11111111 11111111 11111111 11111111
). - The
NULL
value for theINTEGER
type is represented internally with the value0x80000000
(10000000 00000000 00000000 00000000
). WhenNULL
is used with theutil.Integer
bitwise methods, it will be interpreted as0x80000000
instead of a null value. However, if the result of the bitwise operation produces the value0x80000000
, it will be interpreted asNULL
when used in an expression.
Example
IMPORT util
MAIN
DISPLAY util.Integer.shiftLeft(
util.Integer.parseBinaryString("11"),
3 ) -- displays 24
END MAIN