Java Array Max Value maxValue(double[] from)

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

Description

max Value

License

Apache License

Declaration

public static double maxValue(double[] from) 

Method Source Code

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

public class Main {
    public static double maxValue(double[] from) {
        double result = from[0];
        for (int i = 1; i < from.length; ++i)
            if (from[i] > result)
                result = from[i];//from w  w  w . j av a  2  s  .  c  o m
        return result;
    }

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

    public static float maxValue(float[] from, int start, int end) {
        float result = from[start];
        for (int i = start + 1; i < end; ++i)
            if (from[i] > result)
                result = from[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;
    }

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

Related

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