Check if a list of ints is pairwise sorted
if (size &lt;= 1) {
        // Pairwise sorted for lists smaller than two elements
        return true;
    }



Special cases are sometimes useful, but KISS: does this simplify the code or make it more complex for no benefit?




    boolean reIncrementSize = false;
    if (size % 2 != 0) {
        reIncrementSize = true;
        size--;
    }

  
  ....

    if (reIncrementSize) {
        size++;
    }



Yikes! It really shouldn't be necessary to make temporary changes to the state of the class. But if you really absolutely have to do it, you should use try ... finally to guarantee that they are undone. Here the temporary changes introduce a bug: if we hit the return false then the size is permanently decremented.




    for(int i = 0; i &lt; size; i+=2) {
        // Pairwise sorted if elements are in increasing order
        if (elementData[i] &gt; elementData[i + 1]) {
            return false;
        }
    }



Why was size temporarily decremented? I presume it's to avoid an out of bounds array access in elementData[i + 1]. But you can do that just as well by making that be the guard condition:

    for(int i = 0; i + 1 &lt; size; i+=2) {