The BitArray class represents an array of booleans. It stores them packed inside regular integers to not waste the overhead of storing booleans.
The BitMatrix class represents a two-dimensional array of booleans. It uses a single instance of the BitArray class to store the values.