public static void main(String[] args) {
int[] myArray={1,2,33,56,34,85,32};
int[]newArray=myArray;
Arrays.sort(newArray); --------> //true becaue we have this method. sort array smallest one to largest one
boolean status= false;
for(int i=0;i<newArray.length-1;i++)
{
if (myArray[i]>myArray[i+1])
{
status=false;
break;
}
else
{
status=true;
}
}
System.out.println(status);
}
}
//outPut:
true
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter