Count all X-shaped bits from 8 integers
I think the main issue is that you took a bit-by-bit approach to a problem that seems to be designed to elicit approaches that take advantage of bitwise operations, which made the solution less elegant(?) than intended. There is a lot of code to extract individual bits and testing them, and an extra loop to go over the startingPosition, and we can do away with that. I don't expect a performance problem with your solution though, 0.2 seconds is a ton of time (running literally a billion instructions in that time is not unreasonable) and barely any memory is allocated.

As you already discovered, the question of "is there an X here" can be answered by ANDing 
 together the bits that make up the X and also ANDing that with the complements of the bits at the positions that must be zero. Rather than working with booleans, we could work with entire 32bit masks at once, and get an entire 32bit mask as a result, which will then indicate the positions where an X is found. The Xs that are present can be counted using Integer.bitCount.

Forming that mask is really the same idea as the code you already wrote, but instead of adding offsets to the startingPosition there will be some bit-shifts. For example:

private static int calculateXMask(int top, int middle, int bottom) {
    return (top &gt;&gt;&gt; 1) &amp; ~top &amp; (top &lt;&lt; 1) &amp;
        (~middle &gt;&gt;&gt; 1) &amp; middle &amp; (~middle &lt;&lt; 1) &amp;
        (bottom &gt;&gt;&gt; 1) &amp; ~bottom &amp; (bottom &lt;&lt; 1);
}


Which can then be applied to every "window" of 3 successive integers in num, with the results bitCounted and added up.