Check if array is monotonic i.e either monotone increasing or monotone decreasing An array A is monotone increasing if for all i &lt;= j, A[i] &lt;= A[j].  An array A is monotone decreasing if for all i &lt;= j, A[i] &gt;= A[j].
Return true if and only if the given array A is monotonic.
public class MonotonicArray {

    public boolean IsMonotonic(int[] numbers) {
        if (numbers == null  || numbers.length == 0) {
            return false;
        }

        if (numbers.length == 1) {
            return true;
        }

        boolean increasing = false;
        boolean decreasing = false;

        for (int index = 0; index &lt; numbers.length - 1; index++) {

            if (numbers[index + 1] == numbers[index]){
                continue;
            }

            if (numbers[index + 1] &gt; numbers[index]) {
                if (!decreasing) {
                    increasing = true;
                } else {
                    return false;
                }
            }

            else  {
                if (!increasing) {
                    decreasing = true;
                } else {
                    return false;
                }

            }

        }
        return increasing || decreasing;
    }
}

Test cases:
class MonotonicArrayTest extends MonotonicArray {

@org.junit.jupiter.api.Test
void isMonotonic1() {

    int[] array =  new int[]{1,2,3};
   assertEquals(true,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic2() {

    int[] array =  new int[]{-1,-2,-3};
    assertEquals(true,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic3() {

    int[] array =  new int[]{1,2,1};
    assertEquals(false,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic4() {
    int[] array =  new int[]{-1,2,-9};
    assertEquals(false,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic5() {

    int[] array =  new int[]{9,3,2};
    assertEquals(true,IsMonotonic(array));
}

@org.junit.jupiter.api.Test
void isMonotonic6() {
    int[] array =  new int[]{};
    assertEquals(false,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic7() {
    int[] array =  new int[]{1};
    assertEquals(true,IsMonotonic(array));
}


@org.junit.jupiter.api.Test
void isMonotonic8() {
    int[] array =  new int[]{9,7,5,4,8,10};
    assertEquals(false,IsMonotonic(array));
}

@org.junit.jupiter.api.Test
void isMonotonic9() {
    int[] array =  new int[]{1,1,2,3};
    assertEquals(true,IsMonotonic(array));
}

@org.junit.jupiter.api.Test
void isMonotonic10() {
    int[] array =  new int[]{1,1,0,-1};
    assertEquals(true,IsMonotonic(array));
}

}
static
IsMonotonic(...) does not need an instance of the MonotonicArray class to function, therefore it should be static.
Consistency
You special case an array of length 1 as monotonic.  Is it really?  It is neither increasing nor decreasing.
What about IsMonotonic(new int[]{1, 1, 1, 1})?  Seems to me that should be true, but it will return false.  Definitely should be added as a test case.  And if it should return true, then ...
Optimization
... checking for length 1 is too restrictive.  Any length 2 array will always be monotonic as well.  Perhaps:
    if (numbers.length == 1) {
        return true;
    }

should be:
    if (numbers.length &lt;= 2) {
        return true;
    }

Looping
This is ugly.  Will Java optimize the numbers.length - 1 calculation as a constant?
    for (int index = 0; index &lt; numbers.length - 1; index++) {

        if (numbers[index + 1] == numbers[index]){
            continue;
        }
        ...

It may be better to use Java's enhanced for loop to extract numbers, and rely on monotonic behaviour allowing equality to handle the first element:
    int current = numbers[0];
    for(int value : numbers) {
        if (value != current) {
           if (value &lt; current) {
              ...
           } else {
              ...
           }
           current = value;
        }
    }