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-27 1:17

>>25
I don't think this works.

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