Get highest number in a Java array.


/**
  * Checks for the highest int in an int array.
  * http://www.victorbyte.net/
  * Returns int value 
  */
public static int getMaxInArray(int[] array)
{
  int max = array[0];
  for(int i: array) max = max > i ? max : i;
  return max;
}
This entry was posted in Code samples and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *