Here is the code you should use for your flip methods for PSA8B

public void flipVertical(int x, int y, int size)
{
   int begwidth = x - (int)size/2;
   int begheight = y - (int)size/2;
   int endwidth = x + (int)size/2;
   int endheight = y + (int)size/2;

   for(int i = begheight; i < endheight; i++)
   {
     for(int j = begwidth, backwards = endwidth; j < x; j++)
     {
       if(backwards > x)
       {
         Pixel sourceP = getPixel(backwards, i);
         Pixel targetP = getPixel(j, i);

         Color sourceC = sourceP.getColor();
         Color targetC = targetP.getColor();
         sourceP.setColor(targetC);
         targetP.setColor(sourceC);
         backwards--;
       }
     }
   }
}




public void flipHorizontal(int x, int y, int size)
{
   int begwidth = x - (int)size/2;
   int begheight = y - (int)size/2;
   int endwidth = x + (int)size/2;
   int endheight = y + (int)size/2;

   for(int i = begwidth; i < endwidth; i++)
   {
     for(int j = begheight, backwards = endheight; j < y; j++)
     {
       if(backwards > y)
       {
         Pixel sourceP = getPixel(i, backwards);
         Pixel targetP = getPixel(i, j);

         Color sourceC = sourceP.getColor();
         Color targetC = targetP.getColor();
         sourceP.setColor(targetC);
         targetP.setColor(sourceC);
         backwards--;
       }
     }
   }