java method to find that a is subset of an array code example
Example 1: java function that returns the index of the largest value in an array
public int getIndexOfLargest( int[] array )
{
if ( array == null || array.length == 0 ) return -1;
int largest = 0;
for ( int i = 1; i < array.length; i++ )
{
if ( array[i] > array[largest] ) largest = i;
}
return largest;
}
Example 2: Write a function that takes in two sorted arrays and returns a new array with all elements sorted not using array method sort.