Java examples for Collection Framework:Array Sort
is array Sorted
//package com.java2s; public class Main { public static <T extends Comparable<T>> boolean isSorted(T arr[]) { if (arr.length == 1) return true; T prev = arr[0];//from www. ja v a2 s . com for (int i = 1; i < arr.length; i++) { if (arr[i].compareTo(prev) < 0) return false; prev = arr[i]; } return true; } }