so how to make such logic
int[] arr = {2, 5, 3}; if (/* arr is sorted */) .... else ...
Its bad that method Array.sort is void
public static boolean isSorted(int[] arr) { for (int i = 0; i < arr.length - 1; i++) { if (a[i + 1] < a[i]) { return false; }; } return true; }