get max value from list of float - Android java.util

Android examples for java.util:List Algorithm

Description

get max value from list of float

Demo Code


//package com.java2s;

public class Main {
    public static float fmax(final float... values) {
        float max = Float.MIN_VALUE;
        for (final float v : values) {
            max = Math.max(v, max);
        }//ww w  .  j  a v a 2 s . c  o m
        return max;
    }

    public static int max(final int... values) {
        int max = Integer.MIN_VALUE;
        for (final int v : values) {
            max = Math.max(v, max);
        }
        return max;
    }
}

Related Tutorials