Show / Hide Table of Contents

Class FHBitSet

Used to represent and manipulate a 32 bit bitset.

Syntax
Examples
FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

Constructors

FHBitSet()

Initializes a new instance of the FHBitSet class.

Declaration
FHBitSet
Examples
FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

Methods

getBitNo(Integer)

Checks if a specified bit is set.

Declaration
Bool getBitNo(Integer number)
Parameters
Type Name Description
Integer number

Bit number to check (0-31).

Returns
Type Description
Bool

True if a specified bit is set; otherwise, false.

Examples
FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

set(Integer)

Initializes the bitset from an Integer.

Declaration
Void set(Integer value)
Parameters
Type Name Description
Integer value

Used to initialize the bitset.

Returns
Type Description
Void
Examples
FHBitSet fh;

fh.set(44);
print(fh.toLsbString());

set(String)

Initializes the bitset from a String.

Declaration
Void set(String rep)
Parameters
Type Name Description
String rep

Used to initialize the bitset. For example, "1234"

Returns
Type Description
Void
Examples
FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

setBitNo(Integer,Bool)

Sets a specific bit.

Declaration
Void setBitNo(Integer number, Bool val)
Parameters
Type Name Description
Integer number

Index of the bit to set

Bool val

Value to set this bit to - (True/False - 1/0).

Returns
Type Description
Void
Examples
FHBitSet fh;

Bool b = true;
fh.set(0);
fh.setBitNo(15, b);
print(fh.toLsbString());
Output: 00000000000000001000000000000000

toInteger()

Returns the bitset as an integer.

Declaration
Integer toInteger()
Returns
Type Description
Integer

The Integer representation of the bitset.

Examples
FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

toLsbString()

Returns an LSB (Least Significant Byte first) string representation of the bitset.

Declaration
String toLsbString()
Returns
Type Description
String

The LSB string representation of the bitset.

Examples
FHBitSet fh;

fh.set(44);
print(fh.toLsbString());
Output: 00000000000000000000000000101100
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top