logo CodeStepByStep logo

sorted

Language/Type: Java arrays traversals

Write a method named sorted that accepts an array of doubles as a parameter and returns true if the list is in sorted order and false if not. For example, if an array named list stores {1.5, 4.3, 7.0, 19.5, 25.1, 46.2} respectively, the call of sorted(list) should return true. You may assume the array has at least one element. A one-element array is considered to be sorted. Do not modify the array passed in.

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.