Class FindLargest
java.lang.Object
|
+--FindLargest
- public class FindLargest
- extends java.lang.Object
Class FindLargest illustrates two methods for finding the largest value in
an array. The first method, findLargest(int[]), works only on arrays of
integers. The second method, findLargest(Comparable[]), works on arrays
that contain elements of any type that implements the Java Comparable
interface.
Method Summary |
java.lang.Object |
findLargest(java.lang.Comparable[] objects)
Return the largest element in the given array of comparable objects. |
int |
findLargest(int[] numbers)
Return the largest element in the given array of integers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FindLargest
public FindLargest()
findLargest
public int findLargest(int[] numbers)
- Return the largest element in the given array of integers. Return
Integer.MIN_VALUE if the array is null or empty.
findLargest
public java.lang.Object findLargest(java.lang.Comparable[] objects)
- Return the largest element in the given array of comparable objects.
Return null if the array is null or empty.