calculateRowCount static method
Calculate the number of rows needed for a grid efficiently
Implementation
static int calculateRowCount(int itemCount, int columnsPerRow) {
if (itemCount <= 0 || columnsPerRow <= 0) return 0;
return (itemCount + columnsPerRow - 1) ~/ columnsPerRow;
}