Calculating holes on a Tetris grid quickly
You can do this faster by doing the whole row at once instead of one bit at a time.  All you need to do is to keep a mask of bits that correspond to your firstFound booleans.  To match the OP's counting scheme (which can triply count a hole), I keep three masks: an underMask, an lNeighborMask, and an rNeighborMask.  underMask is used to count holes underneath the topmost filled square in a column.  lNeighborMask is used to count holes to the left of the column.  rNeighborMask is used to count holes to the right of the column.  (I edited my original answer to account for the triple counting).

The Code

public int calcHolesConverted(int[] grid)
{
    int gridMask      = (1 &lt;&lt; xsize) - 1;
    int underMask     = 0;
    int lNeighborMask = 0;
    int rNeighborMask = 0;
    int foundHoles    = 0;

    for (int y = 0; y &lt; ysize; y++) {
        int line   = grid[y];
        int filled = ~line &amp; gridMask;

        underMask     |= filled;
        lNeighborMask |= (filled &lt;&lt; 1);
        rNeighborMask |= (filled &gt;&gt; 1);

        foundHoles += setOnes1024[underMask &amp; line] +
                      setOnes1024[lNeighborMask &amp; line] +
                      setOnes1024[rNeighborMask &amp; line];
    }
    return foundHoles;
}


In this code, setOnes1024 is an array of size 1024 which contains the number of 1 bits in the corresponding index.  It is analagous to your setOnes array.  Also, this code assumes that the bits to the left of the leftmost column will all be 0.  If they are not, then you will need to adjust lneighborMask to not contain bits outside the valid columns.

The Timing Test

I ran this timing test by converting both functions to C and running them on the same randomized grid (20000000 iterations each function).

OP's function    : 8.2 seconds
Modified function: 1.4 seconds