Java Array Sort sorted(int[] array)

Here you can find the source of sorted(int[] array)

Description

sorted

License

Open Source License

Declaration

public static boolean sorted(int[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean sorted(int[] array) {
        int last = array[0], current;
        for (int i = 0; i < array.length; i++) {
            current = array[i];/*  w  w  w  .ja v a  2s.co m*/
            if (last > current) {
                return false;
            }
            last = current;
        }
        return true;
    }
}

Related

  1. sortByValueStable(int start, int end, double[] values, int[] indexes)
  2. sortCompare(String[] valuesOne, String[] valuesTwo)
  3. sortDesc(long[] keys, int[] values)
  4. sortDescending(T[] a, int fromIndex, int toIndex)
  5. SortDoubleDimensionArray(String StrArr[][])
  6. sortedArraysEqual(Object[] arr1, Object[] arr2)
  7. sortedCopyOf(final int[] array)
  8. sortedIndex(double[] values)
  9. sortedIndexOf(Comparable[] list, Comparable val, int lower, int higher)