code: public void sort() {
          if (left > right) {
              int temp = left;
              left = right;
              right = temp;
          }
          if (top > bottom) {
              int temp = top;
              top = bottom;
              bottom = temp;
          }
      }
docs: Swap top/bottom or left/right if there are flipped (i.e. left - right
  and/or top - bottom). This can be called if
  the edges are computed separately, and may have crossed over each other.
  If the edges are already correct (i.e. left - right and top - bottom)
  then nothing is done.