package me.alivecode.algs4;

import edu.princeton.cs.algs4.StdOut;

class SortUtil {
    public static boolean less(Comparable v, Comparable w) {
        return v.compareTo(w) < 0; 
    }

    public static void exch(Object[] a, int i, int j) {
        Object tmp = a[i];
        a[i]= a[j];
        a[j] = tmp;
    }

    public static boolean isSorted(Comparable[] a) {
        for(int i = 1; i < a.length; i++) {
            if (less(a[i], a[i-1])) { return false; }
        }
        return true;
    }

    public static void show(Object[] a) {
        for(Object c : a) {
            StdOut.println(c);
        }
    }
}

@@ -357,32 +357,149 @@
 mparable%5B%5D a) %7B%0A
+        return isSorted(a, 0, a.length);%0A    %7D%0A%0A    public static boolean isSorted(Comparable%5B%5D a, int lo, int hi) %7B%0A
         for(int 
@@ -505,16 +505,21 @@
  i =
+ lo +
  1; i %3C 
 a.le
@@ -514,24 +514,18 @@
  1; i %3C 
-a.lengt
 h
+i
 ; i++) %7B
@@ -539,17 +539,16 @@
       if
- 
 (less(a%5B

Add isSorted method.