Here you can find the source of getSecondMaxInArray(float[] arr)
public static int getSecondMaxInArray(float[] arr)
//package com.java2s; //License from project: LGPL public class Main { public static int getSecondMaxInArray(float[] arr) { int max = 0; int secondMax = 0; for (int i = 1; i < arr.length; i++) { if (arr[i] > arr[max]) max = i;//from w ww . j a va2 s .co m } for (int i = 1; i < arr.length; i++) { if (arr[i] > arr[secondMax] && arr[i] < arr[max]) secondMax = i; } return secondMax; } }