public static float maxIndex(float[] arr){
    float max = 0;
    float maxVal = Float.MIN_VALUE;
    for (int i = 0 ; i < arr.length; i++){
      if (arr[i] > maxVal) max = i;
    }
    return max;
  }