Q:

Swap top and bottom 2 bits for each row/col in an int[][] Array using bit operators JAVA

I need to take some array and exchange the bottom 2 bits with the top 2 bits for each [row][col], and I am pretty lost. I found a similar thread on here with this bit of code: 
for (int row = 0; row < height; row++) {
    for (int col = 0; col < width; col++) {

        int pic = image[row][col];
        int top  = (pic & 0b11110000) >> 2;
        int bottom = (pic & 0b00001111) << 2;
        pic = top | bottom;
        image[row][col] = pic;
    }
}

and it almost seems to work, but isn't quite right. Additionally, I do not understand this portion: 0b00001111 at all. 
I found that code here, that thread seems to be the exact same problem that I am working on....like including the other code. The instructions I was given are: 
"Calling swap restores an image in which each pixel has been scrambled by exhanging the bottom 2 bits with the top 2 bits. To do this requires that your code do the same exchange to restore the image.
NOTE: The maximum value of a pixel (Picture.MAXVAL) is 255, so only 8 bits are valid for each pixel. These are numbered bits 0-7, where bit 0 is equal to 1 and bit 7 is equal to 128. There are no negative values allowed."

A:

I think this is what you want, it appears you are mixing up bits and bytes. An integer is 4 bytes, which is 32 bits.
for (int row = 0; row < height; row++) {
    for (int col = 0; col < width; col++) {
        int mask = 0b11111111_11111111_00000000_00000000;

        int pic = image[row][col];
        int top  = (pic & mask ) >> 16;
        int bottom = (pic & ~mask) << 16;
        pic = top | bottom;
        image[row][col] = pic;
    }
}

If you do actually want to swap the top 2 bits with bottom
for (int row = 0; row < height; row++) {
    for (int col = 0; col < width; col++) {
        int maskTop = 0b11000000_00000000_00000000_00000000;
        int maskBottom = 0b00000000_00000000_00000000_00000011;
        int pic = image[row][col];
        int top  = (pic & maskTop) >> 30;
        int bottom = (pic & maskBottom) << 30;
        pic = top | bottom | (image[row][col]&~(maskTop+maskBottom));
        image[row][col] = pic;
    }
}

I haven't tested either of these, but they look right.

