Java Array Max Value maxValue(double[] ary)

Here you can find the source of maxValue(double[] ary)

Description

max Value

License

Apache License

Declaration

public static double maxValue(double[] ary) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double maxValue(double[] ary) {
        return maxValue(ary, 0, ary.length);
    }//from  w ww . j av a2 s.com

    public static double maxValue(double[] ary, int from, int to) {
        double result = ary[from];
        for (int i = from + 1; i < to; ++i)
            if (ary[i] > result)
                result = ary[i];
        return result;
    }

    public static float maxValue(float[] ary) {
        return maxValue(ary, 0, ary.length);
    }

    public static float maxValue(float[] ary, int from, int to) {
        float result = ary[from];
        for (int i = from + 1; i < to; ++i)
            if (ary[i] > result)
                result = ary[i];
        return result;
    }

    public static long maxValue(long[] from) {
        long result = from[0];
        for (int i = 1; i < from.length; ++i)
            if (from[i] > result)
                result = from[i];
        return result;
    }
}

Related

  1. maxRowLen(Object[]... arr)
  2. maxSize(String[] string)
  3. maxSort(double[] arr)
  4. maxStartFromIndex(double[] array, int startFromIndex)
  5. maxSum(int[] array)
  6. maxValue(double[] from)
  7. maxValue(final int[] arr)
  8. maxValue(float[] arr)
  9. maxValue(int[] arr)