title: Check to see if array is sorted recursively in java
body: <p>I want to write a method (returning a boolean value) named <code>itisSorted</code> that takes two arguments; <ul><li> <code>data</code>: an integer array</li><li><code>n</code>: the number of elements  in the array</li></ul> and recursively checks whether the array is sorted. That is, returning <code>true</code> if (and only if) the <code>data</code> array is sorted.</p>
  
  <pre><code>public boolean itisSorted(int [] data, int n)
  {
    if(data.length ==0 || data.length==1) 
    return true;
    else if (data[n] &gt; data[n-1]) //here i compare the first two elements 
    return false;
     else //here is where i put the recursive call to check if 
      // the rest of the array is sorted, but I am having difficulties with the 
      // part of the code
  }
  </code></pre>