Java Second Get getSecondMaxInArray(float[] arr)

Here you can find the source of getSecondMaxInArray(float[] arr)

Description

get Second Max In Array

License

LGPL

Declaration

public static int getSecondMaxInArray(float[] arr) 

Method Source Code

//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;
    }
}

Related

  1. getSecondField(String rowStr, char delimiter)
  2. getSecondFromHMS(String hms)
  3. getSecondFromTime(int hour, int minute, int second)
  4. getSecondInt(long c)
  5. getSecondInt(long time)
  6. getSecondName(String names)
  7. getSecondRDNValue(String dn)
  8. getSecondRulePart()
  9. getSeconds()