Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

java, index of maximum element in array

Name: Anonymous 2009-01-26 12:02

public static int maximum(double[] a){
  double max = a[0];
  int position = 0;
  for (int i = 1; i < a.length; i++) {
    if (a[i] > max) {
      max = a[i];
      position = i;
    }
  }
  return position;
}

//DONE.

Name: Anonymous 2009-01-26 12:52

>>5
Your next objective: get this included in the PHP standard library.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List