rotate180 method
void
rotate180()
Modifies this BitMatrix
to represent the same but rotated 180 degrees
Implementation
void rotate180() {
BitArray topRow = BitArray(_width);
BitArray bottomRow = BitArray(_width);
final maxHeight = (_height + 1) ~/ 2;
for (int i = 0; i < maxHeight; i++) {
topRow = getRow(i, topRow);
final bottomRowIndex = _height - 1 - i;
bottomRow = getRow(bottomRowIndex, bottomRow);
topRow.reverse();
bottomRow.reverse();
setRow(i, bottomRow);
setRow(bottomRowIndex, topRow);
}
}